@@ -72,39 +72,6 @@ QgsLayoutSize QgsLayoutFrame::fixedSize() const
7272 return QgsLayoutSize ( mMultiFrame ->fixedFrameSize ( frameIndex ), QgsUnitTypes::LayoutMillimeters );
7373}
7474
75- #if 0 // TODO - save/restore multiframe uuid!
76- bool QgsLayoutFrame::writeXml( QDomElement &elem, QDomDocument &doc ) const
77- {
78- QDomElement frameElem = doc.createElement( QStringLiteral( "ComposerFrame" ) );
79- frameElem.setAttribute( QStringLiteral( "sectionX" ), QString::number( mSection.x() ) );
80- frameElem.setAttribute( QStringLiteral( "sectionY" ), QString::number( mSection.y() ) );
81- frameElem.setAttribute( QStringLiteral( "sectionWidth" ), QString::number( mSection.width() ) );
82- frameElem.setAttribute( QStringLiteral( "sectionHeight" ), QString::number( mSection.height() ) );
83- frameElem.setAttribute( QStringLiteral( "hidePageIfEmpty" ), mHidePageIfEmpty );
84- frameElem.setAttribute( QStringLiteral( "hideBackgroundIfEmpty" ), mHideBackgroundIfEmpty );
85- elem.appendChild( frameElem );
86-
87- return _writeXml( frameElem, doc );
88- }
89-
90- bool QgsLayoutFrame::readXml( const QDomElement &itemElem, const QDomDocument &doc )
91- {
92- double x = itemElem.attribute( QStringLiteral( "sectionX" ) ).toDouble();
93- double y = itemElem.attribute( QStringLiteral( "sectionY" ) ).toDouble();
94- double width = itemElem.attribute( QStringLiteral( "sectionWidth" ) ).toDouble();
95- double height = itemElem.attribute( QStringLiteral( "sectionHeight" ) ).toDouble();
96- mSection = QRectF( x, y, width, height );
97- mHidePageIfEmpty = itemElem.attribute( QStringLiteral( "hidePageIfEmpty" ), QStringLiteral( "0" ) ).toInt();
98- mHideBackgroundIfEmpty = itemElem.attribute( QStringLiteral( "hideBackgroundIfEmpty" ), QStringLiteral( "0" ) ).toInt();
99- QDomElement composerItem = itemElem.firstChildElement( QStringLiteral( "ComposerItem" ) );
100- if ( composerItem.isNull() )
101- {
102- return false;
103- }
104- return _readXml( composerItem, doc );
105- }
106- #endif
107-
10875int QgsLayoutFrame::type () const
10976{
11077 return QgsLayoutItemRegistry::LayoutFrame;
@@ -118,14 +85,6 @@ QIcon QgsLayoutFrame::icon() const
11885 return QIcon ();
11986}
12087
121- QString QgsLayoutFrame::uuid () const
122- {
123- if ( mMultiFrame )
124- return mMultiFrame ->uuid () + ' :' + mMultiFrame ->frameIndex ( const_cast < QgsLayoutFrame * >( this ) );
125- else
126- return QgsLayoutItem::uuid ();
127- }
128-
12988void QgsLayoutFrame::setHidePageIfEmpty ( const bool hidePageIfEmpty )
13089{
13190 mHidePageIfEmpty = hidePageIfEmpty;
@@ -168,10 +127,8 @@ QgsExpressionContext QgsLayoutFrame::createExpressionContext() const
168127 // start with multiframe's context
169128 QgsExpressionContext context = mMultiFrame ->createExpressionContext ();
170129
171- #if 0 //TODO
172130 // add frame's individual context
173131 context.appendScope ( QgsExpressionContextUtils::layoutItemScope ( this ) );
174- #endif
175132
176133 return context;
177134}
@@ -226,6 +183,33 @@ void QgsLayoutFrame::drawBackground( QgsRenderContext &context )
226183 }
227184}
228185
186+ bool QgsLayoutFrame::writePropertiesToElement ( QDomElement &parentElement, QDomDocument &, const QgsReadWriteContext & ) const
187+ {
188+ parentElement.setAttribute ( QStringLiteral ( " multiFrame" ), mMultiFrameUuid );
189+ parentElement.setAttribute ( QStringLiteral ( " sectionX" ), QString::number ( mSection .x () ) );
190+ parentElement.setAttribute ( QStringLiteral ( " sectionY" ), QString::number ( mSection .y () ) );
191+ parentElement.setAttribute ( QStringLiteral ( " sectionWidth" ), QString::number ( mSection .width () ) );
192+ parentElement.setAttribute ( QStringLiteral ( " sectionHeight" ), QString::number ( mSection .height () ) );
193+ parentElement.setAttribute ( QStringLiteral ( " hidePageIfEmpty" ), mHidePageIfEmpty );
194+ parentElement.setAttribute ( QStringLiteral ( " hideBackgroundIfEmpty" ), mHideBackgroundIfEmpty );
195+ return true ;
196+ }
197+
198+ bool QgsLayoutFrame::readPropertiesFromElement ( const QDomElement &itemElem, const QDomDocument &, const QgsReadWriteContext & )
199+ {
200+ double x = itemElem.attribute ( QStringLiteral ( " sectionX" ) ).toDouble ();
201+ double y = itemElem.attribute ( QStringLiteral ( " sectionY" ) ).toDouble ();
202+ double width = itemElem.attribute ( QStringLiteral ( " sectionWidth" ) ).toDouble ();
203+ double height = itemElem.attribute ( QStringLiteral ( " sectionHeight" ) ).toDouble ();
204+ mSection = QRectF ( x, y, width, height );
205+ mHidePageIfEmpty = itemElem.attribute ( QStringLiteral ( " hidePageIfEmpty" ), QStringLiteral ( " 0" ) ).toInt ();
206+ mHideBackgroundIfEmpty = itemElem.attribute ( QStringLiteral ( " hideBackgroundIfEmpty" ), QStringLiteral ( " 0" ) ).toInt ();
207+
208+ mMultiFrameUuid = itemElem.attribute ( QStringLiteral ( " multiFrame" ) );
209+ mMultiFrame = mLayout ->multiFrameByUuid ( mMultiFrameUuid );
210+ return true ;
211+ }
212+
229213#if 0 //TODO
230214void QgsLayoutFrame::beginItemCommand( const QString &text )
231215{
0 commit comments