include/xmloff/shapeexport.hxx | 4 reportdesign/source/filter/xml/xmlExport.cxx | 4 sc/source/filter/xml/xmlexprt.cxx | 8 - svx/source/svdraw/svdobj.cxx | 2 wizards/com/sun/star/wizards/document/FormHandler.java | 13 + wizards/com/sun/star/wizards/document/TimeStampControl.java | 40 ----- wizards/com/sun/star/wizards/form/FormControlArranger.java | 91 ++++++------ wizards/com/sun/star/wizards/form/FormDocument.java | 1 xmloff/source/chart/SchXMLExport.cxx | 4 xmloff/source/draw/shapeexport.cxx | 36 ++-- xmloff/source/forms/elementimport.cxx | 9 + xmloff/source/forms/layerexport.cxx | 2 xmloff/source/forms/propertyexport.cxx | 8 - xmloff/source/text/txtparae.cxx | 2 14 files changed, 114 insertions(+), 110 deletions(-)
New commits: commit c2cca8439d385d24c8de3601ff90d7522ff9c9a5 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 23:29:26 2014 +0100 correct function name in debug message Change-Id: I9c02fdd99504bdee6654d1072559a4afac6532a3 diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx index 6fa19a3..9057ae7 100644 --- a/xmloff/source/forms/layerexport.cxx +++ b/xmloff/source/forms/layerexport.cxx @@ -605,7 +605,7 @@ namespace xmloff { // the column indeed has a formatting sal_Int32 nStyleMapIndex = m_xStyleExportMapper->getPropertySetMapper()->FindEntryIndex( CTF_FORMS_DATA_STYLE ); // TODO: move this to the ctor - OSL_ENSURE ( -1 != nStyleMapIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!"); + OSL_ENSURE ( -1 != nStyleMapIndex, "OFormLayerXMLExport_Impl::collectGridColumnStylesAndIds: could not obtain the index for our context id!"); XMLPropertyState aNumberStyleState( nStyleMapIndex, makeAny( sColumnNumberStyle ) ); aPropertyStates.push_back( aNumberStyleState ); commit be2aa71a2caba12c7e2e0fc03cba30c6f6d81619 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 23:29:07 2014 +0100 survive "TextBox" having no value Change-Id: Iebed41cfcc5899387e3defb8d8a0792276349098 diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 5276afb..f8d417c 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -358,7 +358,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap } } - if (aParentName.isEmpty() && xPropertySetInfo->hasPropertyByName("TextBox") && xPropSet->getPropertyValue("TextBox").get<bool>()) + if (aParentName.isEmpty() && xPropertySetInfo->hasPropertyByName("TextBox") && xPropSet->getPropertyValue("TextBox").hasValue() && xPropSet->getPropertyValue("TextBox").get<bool>()) { // Shapes with a Writer TextBox always have a parent style. // If there would be none, then just assign the first available. commit 0685b2e73e48adb84cd01355d45551ab478ebcd5 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 23:25:21 2014 +0100 Assume that as long as the model is the same, the shape doesn't change. Even if it is moved from not a page to a page or vice-versa. This allows assumptions made in the Base Form wizard to hold, namely that if one: 1) Creates controls (and their associated shapes) 2) Groups the shapes (in a GroupShape) Then all the shapes still remember their associated control and vice-versa. Change-Id: I31975970e7ea2f7978aea7f753de88ecd8e55234 diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 3ff4238..0862bab 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -530,7 +530,7 @@ void SdrObject::SetPage(SdrPage* pNewPage) // If the page is changing to another page with the same model, we // assume they create compatible UNO shape objects so we shouldn't have // to invalidate. - if (pOldPage != pPage && !(pOldPage && pPage && pOldModel == pModel)) + if (pOldPage != pPage && pOldModel != pModel) { SvxShape* const pShape(getSvxShape()); if (pShape && !pShape->HasSdrObjectOwnership()) commit 8fdc6735d740dbdc09a3b14ec3d5fc6234ad2370 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 23:25:00 2014 +0100 janitorial Change-Id: I91387b354d0034410819dbcb8dc1ad8889fc8f14 diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java index 17698c2..3aed54d 100644 --- a/wizards/com/sun/star/wizards/form/FormDocument.java +++ b/wizards/com/sun/star/wizards/form/FormDocument.java @@ -557,7 +557,6 @@ public class FormDocument extends TextDocument { oFormHandler.groupShapesTogether(xMSF, oLabelControls[i].xShape, oDBControls[i].xShape); } - } } } commit 04b6b86656abd68740efe21ab03f1cf8e26ac78e Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 23:23:25 2014 +0100 janitorial Change-Id: I3e79b0b34507b947ac4234bab45265027e445d7f diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index bfa972c..293d4b3 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -629,7 +629,6 @@ public class FormControlArranger aDBControl.setPosition(aPoint); } if (nFieldType == DataType.LONGVARCHAR) /* memo */ - { Helper.setUnoPropertyValue(aDBControl.xPropertySet, PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE); } commit 2a7a6d1a70ae0087bbd77bf84df1f38d47d4801d Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 23:21:52 2014 +0100 protect against division by zero Change-Id: Ib91120e626f772bb52531c4a35fc70f04cc5c48f diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index 8b23743..bfa972c 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -227,7 +227,10 @@ public class FormControlArranger // shapes are made more narrow ShapeCount = iReduceWidth; } - return (nDist) / ShapeCount; + if(ShapeCount == 0) + return 0; + else + return (nDist) / ShapeCount; } /** @@ -237,51 +240,54 @@ public class FormControlArranger * @param nDist * @param WidthFactor is either '+1' or '-1' and determines whether the control shapes widths are to be made smaller or larger */ - private void adjustLineWidth(int StartIndex, int EndIndex, int nDist, int WidthFactor) + private void adjustLineWidth(final int StartIndex, final int EndIndex, final int nDist, final int WidthFactor) { - int CorrWidth = getCorrWidth(StartIndex, EndIndex, nDist, WidthFactor); - int iLocTCPosX = cXOffset; - for (int i = StartIndex; i <= EndIndex; i++) + if(StartIndex <= EndIndex) { - int nControlBaseWidth = 0; - DatabaseControl dbControl = DBControlList[i]; - Control curLabelControl = LabelControlList[i]; - if (i != StartIndex) - { - curLabelControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y)); - dbControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + m_LabelHeight)); - } - final Size labelSize = curLabelControl.getSize(); - Size controlSize = dbControl.getSize(); - if (((labelSize.Width > controlSize.Width)) && (WidthFactor > 0)) - { - nControlBaseWidth = labelSize.Width; - } - else - { - nControlBaseWidth = controlSize.Width; - } - if (FieldColumns[i].getFieldType() == DataType.TIMESTAMP) - { - TimeStampControl oDBTimeStampControl = (TimeStampControl) dbControl; - nControlBaseWidth = oDBTimeStampControl.getSize().Width; - } - if (WidthFactor > 0 || isReducable(i, labelSize.Width, controlSize.Width)) + int CorrWidth = getCorrWidth(StartIndex, EndIndex, nDist, WidthFactor); + int iLocTCPosX = cXOffset; + for (int i = StartIndex; i <= EndIndex; i++) { - controlSize.Width = nControlBaseWidth + WidthFactor * CorrWidth; - dbControl.setSize(controlSize); - controlSize = dbControl.getSize(); - } + int nControlBaseWidth = 0; + DatabaseControl dbControl = DBControlList[i]; + Control curLabelControl = LabelControlList[i]; + if (i != StartIndex) + { + curLabelControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y)); + dbControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + m_LabelHeight)); + } + final Size labelSize = curLabelControl.getSize(); + Size controlSize = dbControl.getSize(); + if (((labelSize.Width > controlSize.Width)) && (WidthFactor > 0)) + { + nControlBaseWidth = labelSize.Width; + } + else + { + nControlBaseWidth = controlSize.Width; + } + if (FieldColumns[i].getFieldType() == DataType.TIMESTAMP) + { + TimeStampControl oDBTimeStampControl = (TimeStampControl) dbControl; + nControlBaseWidth = oDBTimeStampControl.getSize().Width; + } + if (WidthFactor > 0 || isReducable(i, labelSize.Width, controlSize.Width)) + { + controlSize.Width = nControlBaseWidth + WidthFactor * CorrWidth; + dbControl.setSize(controlSize); + controlSize = dbControl.getSize(); + } - if (labelSize.Width > controlSize.Width) - { - iLocTCPosX += labelSize.Width; - } - else - { - iLocTCPosX += controlSize.Width; + if (labelSize.Width > controlSize.Width) + { + iLocTCPosX += labelSize.Width; + } + else + { + iLocTCPosX += controlSize.Width; + } + iLocTCPosX += cHoriDistance; } - iLocTCPosX += cHoriDistance; } if (WidthFactor > 0) { commit e59629b94e36aaa7b2bfb24e433c1c25cbd479b4 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 23:19:36 2014 +0100 Keep as xShapes the newly created GroupShape That's what we should refer to later, not the temporary collection we made! Change-Id: Ie288222c6aefa0f50a0b0878ad83b78909ee56d1 diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index c0194ee..0706e32 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -57,6 +57,7 @@ public class TimeStampControl extends DatabaseControl xShapes.add(oDateControl.xShape); xShapes.add(oTimeControl.xShape); xShape = _oFormHandler.xShapeGrouper.group(xShapes); + xShapes = UnoRuntime.queryInterface(XShapes.class, xShape); nreldatewidth = 1.0 / ((double) getSize().Width / (double) nDateWidth); nreltimewidth = 1.0 - nreldatewidth; } commit c976789b1bebecdbe58b7b05a33a5a1f6c2a2c0c Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 23:09:35 2014 +0100 GroupShape takes care of scaling the subshapes Change-Id: I1e913287229119276fa97f73cb249ed0a0b2c473 diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index 0fced1d..c0194ee 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -100,27 +100,6 @@ public class TimeStampControl extends DatabaseControl return nDBWidth; } - public void setSize(Size _aSize) - { - try - { - int ndatewidth = (int) (nreldatewidth * _aSize.Width); - int ntimewidth = (int) (nreltimewidth * _aSize.Width); - oDateControl.xShape.setSize(new Size(ndatewidth, _aSize.Height)); - oTimeControl.xShape.setSize(new Size(ntimewidth, _aSize.Height)); - } - catch (PropertyVetoException e) - { - e.printStackTrace(System.err); - } - } - - public Size getSize() - { - int ncontrolwidth = oDateControl.xShape.getSize().Width + oTimeControl.xShape.getSize().Width; - return new Size(ncontrolwidth, oDateControl.xShape.getSize().Height); - } - public int getControlType() { return FormHandler.SODATETIMECONTROL; commit 14cef6e547b9cbcfc4a6db90e453194d0e73eaf3 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 22:59:15 2014 +0100 detect groupShapes (TimestampFields) in forms, too as a consequence, successfully delete them Change-Id: I5dd7b329708dd13f8bfe4a38974c5f6f1202b392 diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java index a8b02d3..8a34ec8 100644 --- a/wizards/com/sun/star/wizards/document/FormHandler.java +++ b/wizards/com/sun/star/wizards/document/FormHandler.java @@ -266,6 +266,19 @@ public class FormHandler private boolean belongsToForm(Object _oDrawPageElement, String _FormName) { XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement); + while (xServiceInfo.supportsService("com.sun.star.drawing.GroupShape")) + { + XShapes xShapes = UnoRuntime.queryInterface(XShapes.class, _oDrawPageElement); + try + { + _oDrawPageElement = xShapes.getByIndex(0); + xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement); + } + catch(final com.sun.star.uno.Exception e) + { + return false; + } + } if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape")) { XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, _oDrawPageElement); commit d566256b78f56bfb2e6eba747d54087527ba4baf Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 22:01:19 2014 +0100 xShapeGroup *is* the control's global xShape, so use it as such this allows the rest of the code to automagically do the right stuff: - get&set position - group this control with its label - set the label property to the label control - ... Conflicts: wizards/com/sun/star/wizards/document/TimeStampControl.java Change-Id: Ibf3cb0ae82ba5c8a23fde05f6466f8eec8308186 diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index 42b8b53..0fced1d 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -40,7 +40,6 @@ public class TimeStampControl extends DatabaseControl private double nreldatewidth; private double nreltimewidth; private int nDBWidth; - private XShape xShapeGroup; public TimeStampControl(Resource _oResource, FormHandler _oFormHandler, XNameContainer _xFormName, String _curFieldName, Point _aPoint) { @@ -57,7 +56,7 @@ public class TimeStampControl extends DatabaseControl nDBWidth = nDateWidth + nTimeWidth + 10; xShapes.add(oDateControl.xShape); xShapes.add(oTimeControl.xShape); - xShapeGroup = _oFormHandler.xShapeGrouper.group(xShapes); + xShape = _oFormHandler.xShapeGrouper.group(xShapes); nreldatewidth = 1.0 / ((double) getSize().Width / (double) nDateWidth); nreltimewidth = 1.0 - nreldatewidth; } @@ -122,20 +121,6 @@ public class TimeStampControl extends DatabaseControl return new Size(ncontrolwidth, oDateControl.xShape.getSize().Height); } - public Point getPosition() - { - return xShapeGroup.getPosition(); - } - - public void setPosition(Point _aPoint) - { - // --> TESTING - Point aBeforePt = xShapeGroup.getPosition(); - xShapeGroup.setPosition(_aPoint); - // --> TESTING - Point aAfterPt = xShapeGroup.getPosition(); - } - public int getControlType() { return FormHandler.SODATETIMECONTROL; commit 66c7dbbf7dfba8cfab63f8d1df72ace87e5bf7ca Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 21:38:35 2014 +0100 Don't assume that the ZOrder property of shapes is an enumeration ...at least when we can easily not assume it. shapes = shapes of the same XShapes an enumeration = it is the sequence 0, 1, 2, 3, ..., XShapes->getCount()-1 We replace the ZOrder property by the index of the XShape in the XShapes (the same XShapes that is passed to seekShapes()... when that is easy to find. Else, use ZOrder and hope for the best. ZOrders are not always an enumeration. For example, in documents (forms) created by the Base forms wizard, it is not the case. The wrong assumptions was leading to the following bugs in the Base form wizard: - Only the first two controls in the form were successfully saved. The others were just dropped. - Whereas the labels had the proper style (background and text colour) applied while creating the document, these were not saved successfully Change-Id: I15b9a3ef3b16eafa9698332e35d82d51d51627f8 diff --git a/include/xmloff/shapeexport.hxx b/include/xmloff/shapeexport.hxx index 134b15f..71e1683 100644 --- a/include/xmloff/shapeexport.hxx +++ b/include/xmloff/shapeexport.hxx @@ -247,11 +247,13 @@ public: // This method collects all automatic styles for the given XShape void collectShapeAutoStyles( - const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape); + const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape, + sal_Int32 nShapeId = -1); // This method exports the given XShape void exportShape( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape, + sal_Int32 nShapeId = -1, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL, SvXMLAttributeList* pAttrList = NULL diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 27fca7f..227b9d8 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -674,7 +674,7 @@ void ORptExport::exportReportComponentAutoStyles(const Reference<XSection>& _xPr rtl::Reference< XMLShapeExport > xShapeExport = GetShapeExport(); xShapeExport->seekShapes(_xProp.get()); SolarMutexGuard aGuard; - xShapeExport->collectShapeAutoStyles(xShape.get()); + xShapeExport->collectShapeAutoStyles(xShape.get(), i); } else { @@ -1501,7 +1501,7 @@ void ORptExport::exportShapes(const Reference< XSection>& _xSection,bool _bAddPa } AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, XML_PARAGRAPH ); - xShapeExport->exportShape(xShape.get(),SEF_DEFAULT|SEF_EXPORT_NO_WS,&aRefPoint); + xShapeExport->exportShape(xShape.get(), i, SEF_DEFAULT|SEF_EXPORT_NO_WS,&aRefPoint); } } } diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 22f71c9..f468fca 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3471,7 +3471,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape, pAttrList->AddAttribute( GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW, GetXMLToken( XML_NOTIFY_ON_UPDATE_OF_RANGES ) ), sRanges ); } - GetShapeExport()->exportShape( xShape, SEF_EXPORT_NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList ); + GetShapeExport()->exportShape( xShape, -1, SEF_EXPORT_NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList ); } } } @@ -3505,7 +3505,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape, pAttrList->AddAttribute( GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_DRAW, GetXMLToken(XML_NOTIFY_ON_UPDATE_OF_RANGES) ), sRanges ); } - GetShapeExport()->exportShape(xShape, SEF_EXPORT_NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList); + GetShapeExport()->exportShape(xShape, -1, SEF_EXPORT_NO_CHART_DATA | SEF_DEFAULT, pPoint, pAttrList); } } } @@ -3547,7 +3547,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape, // re-add pre-loaded attributes AddAttributeList( xSaveAttribs ); } - GetShapeExport()->exportShape(xShape, SEF_DEFAULT, pPoint); + GetShapeExport()->exportShape(xShape, -1, SEF_DEFAULT, pPoint); } IncrementProgressBar(false); } @@ -3717,7 +3717,7 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell) SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(rMyCell.maCellAddress); Reference<drawing::XShape> xShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY ); - GetShapeExport()->exportShape(xShape, SEF_DEFAULT|SEF_EXPORT_ANNOTATION, NULL); + GetShapeExport()->exportShape(xShape, -1, SEF_DEFAULT|SEF_EXPORT_ANNOTATION, NULL); pCurrentCell = NULL; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 9768710..74ea3ba 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1487,7 +1487,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& if( ! xShape.is()) continue; - rShapeExport->exportShape( xShape ); + rShapeExport->exportShape( xShape, nShapeId ); } // this would be the easier way if it worked: //mrExport.GetShapeExport()->exportShapes( mxAdditionalShapes ); @@ -1536,7 +1536,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& if( ! xShape.is()) continue; - rShapeExport->collectShapeAutoStyles( xShape ); + rShapeExport->collectShapeAutoStyles( xShape, nShapeId ); } } } diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index d130629..5276afb 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -235,17 +235,21 @@ uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement } // This method collects all automatic styles for the given XShape -void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape ) +void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape, sal_Int32 nZIndex) { if( maCurrentShapesIter == maShapesInfos.end() ) { OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" ); return; } - sal_Int32 nZIndex = 0; uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); - if( xPropSet.is() ) - xPropSet->getPropertyValue(msZIndex) >>= nZIndex; + if( nZIndex == -1 ) + { + if( xPropSet.is() ) + xPropSet->getPropertyValue(msZIndex) >>= nZIndex; + else + nZindex = 0; + } ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second; @@ -563,6 +567,7 @@ namespace } // This method exports the given XShape void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape, + sal_Int32 nZIndex, sal_Int32 nFeatures /* = SEF_DEFAULT */, com::sun::star::awt::Point* pRefPoint /* = NULL */, SvXMLAttributeList* pAttrList /* = NULL */ ) @@ -573,7 +578,6 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape SAL_WARN( "xmloff", "XMLShapeExport::exportShape(): no auto styles where collected before export" ); return; } - sal_Int32 nZIndex = 0; uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY ); boost::scoped_ptr< SvXMLElementExport > mpHyperlinkElement; @@ -605,8 +609,13 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape SAL_WARN("xmloff", "XMLShapeExport::exportShape(): exception during hyperlink export"); } - if( xSet.is() ) - xSet->getPropertyValue(msZIndex) >>= nZIndex; + if( nZIndex == -1 ) + { + if( xSet.is() ) + xSet->getPropertyValue(msZIndex) >>= nZIndex; + else + nZindex = 0; + } ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second; @@ -953,7 +962,7 @@ void XMLShapeExport::collectShapesAutoStyles( const uno::Reference < drawing::XS if(!xShape.is()) continue; - collectShapeAutoStyles( xShape ); + collectShapeAutoStyles( xShape, nShapeId ); } maCurrentShapesIter = aOldCurrentShapesIter; @@ -974,7 +983,7 @@ void XMLShapeExport::exportShapes( const uno::Reference < drawing::XShapes >& xS if(!xShape.is()) continue; - exportShape( xShape, nFeatures, pRefPoint ); + exportShape( xShape, nShapeId, nFeatures, pRefPoint ); } maCurrentShapesIter = aOldCurrentShapesIter; diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index b2b6772..9ad9892 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2874,7 +2874,7 @@ void XMLTextParagraphExport::exportAnyTextFrame( sal_Int32 nFeatures = addTextFrameAttributes( xPropSet, true ); GetExport().GetShapeExport() - ->exportShape( xShape, nFeatures ); + ->exportShape( xShape, -1, nFeatures ); } break; } commit 1cdb723b27d7359097891c7c370264c9974079db Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 19:36:12 2014 +0100 teach XML import/export about unsigned integer types resolves a shitload of warnings like warn:legacy.osl:941:1:xmloff/source/forms/elementimport.cxx:426: OElementImport::implImportGenericProperties: unsupported value type! warn:legacy.osl:941:1:xmloff/source/forms/elementimport.cxx:443: OElementImport::EndElement: could not set the property "ObjIDinMSO"! warn:legacy.osl:941:1:xmloff/source/forms/elementimport.cxx:444: caught an exception! in function:void xmloff::OElementImport::implApplyGenericProperties() type: com.sun.star.lang.IllegalArgumentException Change-Id: Ia598d12e7d9429fe4ad3b1e7173e11e75060a613 diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index eede26a..14b09e3 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -415,10 +415,19 @@ namespace xmloff case TypeClass_SHORT: aPropValues->Value <<= static_cast< sal_Int16 >( nVal ); break; + case TypeClass_UNSIGNED_SHORT: + aPropValues->Value <<= static_cast< sal_uInt16 >( nVal ); + break; case TypeClass_LONG: case TypeClass_ENUM: aPropValues->Value <<= static_cast< sal_Int32 >( nVal ); break; + case TypeClass_UNSIGNED_LONG: + aPropValues->Value <<= static_cast< sal_uInt32 >( nVal ); + break; + case TypeClass_UNSIGNED_HYPER: + aPropValues->Value <<= static_cast< sal_uInt64 >( nVal ); + break; case TypeClass_HYPER: aPropValues->Value <<= static_cast< sal_Int64 >( nVal ); break; diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index 501c88a..a2a6112 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -539,14 +539,18 @@ namespace xmloff aBuffer = getBOOL(_rValue) ? m_sValueTrue : m_sValueFalse; break; case TypeClass_BYTE: + case TypeClass_UNSIGNED_SHORT: case TypeClass_SHORT: case TypeClass_LONG: // let the unit converter format is as string ::sax::Converter::convertNumber(aBuffer, getINT32(_rValue)); break; + case TypeClass_UNSIGNED_LONG: case TypeClass_HYPER: - // TODO - OSL_FAIL("OPropertyExport::implConvertAny: missing implementation for sal_Int64!"); + ::sax::Converter::convertNumber(aBuffer, getINT64(_rValue)); + break; + case TypeClass_UNSIGNED_HYPER: + ::sax::Converter::convertNumber(aBuffer, _rValue.get<sal_uInt64>()); break; case TypeClass_ENUM: { commit 3d4e1beacbaa84b3aa329a7ef09b59321729d898 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 19:25:46 2014 +0100 two references having same content Change-Id: I2db8842411e39d7d100d0627f8c930bb3f633d77 diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 4162a56..d130629 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -243,9 +243,9 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap return; } sal_Int32 nZIndex = 0; - uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY ); - if( xSet.is() ) - xSet->getPropertyValue(msZIndex) >>= nZIndex; + uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); + if( xPropSet.is() ) + xPropSet->getPropertyValue(msZIndex) >>= nZIndex; ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second; @@ -285,7 +285,6 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap bool bIsEmptyPresObj = false; - uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); if ( aShapeInfo.xCustomShapeReplacement.is() ) xPropSet.clear(); @@ -513,7 +512,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap { try { - uno::Reference< table::XColumnRowRange > xRange( xSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW ); + uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW ); GetShapeTableExport()->collectTableAutoStyles( xRange ); } catch(const uno::Exception&) commit f0471ea7550f42d2899951c06fc854ab9632ff74 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 19:25:07 2014 +0100 this is purely informative, SAL_WARN is overkill Change-Id: Iccb98e50a678e5c53b69fb1052e3dac83cdcf5f5 diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 09ba163..4162a56 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -568,7 +568,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape com::sun::star::awt::Point* pRefPoint /* = NULL */, SvXMLAttributeList* pAttrList /* = NULL */ ) { - SAL_WARN("xmloff", xShape->getShapeType()); + SAL_INFO("xmloff", xShape->getShapeType()); if( maCurrentShapesIter == maShapesInfos.end() ) { SAL_WARN( "xmloff", "XMLShapeExport::exportShape(): no auto styles where collected before export" ); commit 7585336177fd3715f38d78b073fa49591cacad10 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 18:59:56 2014 +0100 set *content* control to multiline, not label(!) Change-Id: Iebf7fa5b2335e5c6d71fdba791e49a6378db8a31 diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java index 92e4299..8b23743 100644 --- a/wizards/com/sun/star/wizards/form/FormControlArranger.java +++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java @@ -625,7 +625,7 @@ public class FormControlArranger if (nFieldType == DataType.LONGVARCHAR) /* memo */ { - Helper.setUnoPropertyValue(LabelControlList[i], PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE); + Helper.setUnoPropertyValue(aDBControl.xPropertySet, PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE); } checkOuterPoints(m_currentControlPosX, m_dbControlWidth, m_currentControlPosY, m_dbControlHeight, true); aDBControl.setPropertyValue(PropertyNames.PROPERTY_BORDER, NBorderType); commit a983fb0f7c7b94d0771d277777035254acce093f Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 17:48:09 2014 +0100 Revert "fdo#87301 don't rely on the shape to get the control" This reverts commit 89b3af722cc13a0af06822afe248cdec3b63cfeb. diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index e77c6b1..42b8b53 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -62,17 +62,22 @@ public class TimeStampControl extends DatabaseControl nreltimewidth = 1.0 - nreldatewidth; } - public XPropertySet getControlByIndex(int _i) + public XPropertySet getControlofGroupShapeByIndex(int _i) { - switch (_i) + try + { + if (_i < xShapes.getCount()) + { + Object oControl = xShapes.getByIndex(_i); + XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, oControl); + return UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl()); + } + } + catch (Exception e) { - case 0: - return oDateControl.xPropertySet; - case 1: - return oTimeControl.xPropertySet; - default: - return null; + e.printStackTrace(System.err); } + return null; } public TimeStampControl(Resource _oResource, GridControl _oGridControl, FieldColumn _curfieldcolumn) diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 10037aa..4a171e0 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -271,7 +271,7 @@ public class StyleApplier TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n]; for (int i = 0; i < 2; i++) { - XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); + XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); if (xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) { xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); @@ -405,7 +405,7 @@ public class StyleApplier TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl; for (int i = 0; i < 2; i++) { - XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); + XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); setDBControlColors(xPropertySet, _iStyleColors); } } commit ffd3388d08aafbbea92c6354064cf1ab6a56bd70 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 17:48:00 2014 +0100 Revert "fix indentation" This reverts commit 534e5676028e41205adba3928f96cd35559b5dca. diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 2495529..10037aa 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -334,11 +334,11 @@ public class StyleApplier { StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", ""); StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles"); - } + } catch (NoValidPathException e) - { - } - return StylesPath; + { + } + return StylesPath; } private int[] getStyleColors(String _filename) @@ -401,16 +401,16 @@ public class StyleApplier if (aDBControl != null) { if (aDBControl.xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")) - { + { TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl; - for (int i = 0; i < 2; i++) - { - XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); - setDBControlColors(xPropertySet, _iStyleColors); - } - } - else + for (int i = 0; i < 2; i++) { + XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); + setDBControlColors(xPropertySet, _iStyleColors); + } + } + else + { setDBControlColors(aDBControl.xPropertySet, _iStyleColors); } } commit 0cc372bb6b3107b749ece41343cb9080fccae83e Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 15:43:37 2014 +0100 fix indentation Change-Id: I13b50f49658a9ca38dc9a41b219428d5faad70a3 diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 10037aa..2495529 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -334,11 +334,11 @@ public class StyleApplier { StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", ""); StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles"); - } + } catch (NoValidPathException e) - { - } - return StylesPath; + { + } + return StylesPath; } private int[] getStyleColors(String _filename) @@ -401,16 +401,16 @@ public class StyleApplier if (aDBControl != null) { if (aDBControl.xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")) - { - TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl; - for (int i = 0; i < 2; i++) { - XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); - setDBControlColors(xPropertySet, _iStyleColors); + TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl; + for (int i = 0; i < 2; i++) + { + XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); + setDBControlColors(xPropertySet, _iStyleColors); + } } - } - else - { + else + { setDBControlColors(aDBControl.xPropertySet, _iStyleColors); } } commit 68f65c4c08a8804b9a28b926c2a08cee486b60e9 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 15:34:32 2014 +0100 fdo#87301 don't rely on the shape to get the control as it forgets its associated control Change-Id: Ia5bd2212725376ab629f2c271102cea2cff9e823 diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index 42b8b53..e77c6b1 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -62,22 +62,17 @@ public class TimeStampControl extends DatabaseControl nreltimewidth = 1.0 - nreldatewidth; } - public XPropertySet getControlofGroupShapeByIndex(int _i) + public XPropertySet getControlByIndex(int _i) { - try - { - if (_i < xShapes.getCount()) - { - Object oControl = xShapes.getByIndex(_i); - XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, oControl); - return UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl()); - } - } - catch (Exception e) + switch (_i) { - e.printStackTrace(System.err); + case 0: + return oDateControl.xPropertySet; + case 1: + return oTimeControl.xPropertySet; + default: + return null; } - return null; } public TimeStampControl(Resource _oResource, GridControl _oGridControl, FieldColumn _curfieldcolumn) diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 4a171e0..10037aa 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -271,7 +271,7 @@ public class StyleApplier TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n]; for (int i = 0; i < 2; i++) { - XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); + XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); if (xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) { xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); @@ -405,7 +405,7 @@ public class StyleApplier TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl; for (int i = 0; i < 2; i++) { - XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); + XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); setDBControlColors(xPropertySet, _iStyleColors); } } commit c47795a6f950f6cc1657819a3411c5828d649771 Author: Lionel Elie Mamane <[email protected]> Date: Fri Dec 19 15:24:30 2014 +0100 remove unnecessary and confusing line XShapeGrouper.group returns a XShapeGroup which is guaranteed to also be a XShape. If it were not a XShape, this code would not even work since the first assignment would not work, since xShapeGroup is of type XShapeGroup. Change-Id: Ic0d873229a1421c3dc94292d7449614a4b6140a3 diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index efd66d0..42b8b53 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -58,7 +58,6 @@ public class TimeStampControl extends DatabaseControl xShapes.add(oDateControl.xShape); xShapes.add(oTimeControl.xShape); xShapeGroup = _oFormHandler.xShapeGrouper.group(xShapes); - xShapeGroup = UnoRuntime.queryInterface(XShape.class, xShapeGroup); nreldatewidth = 1.0 / ((double) getSize().Width / (double) nDateWidth); nreltimewidth = 1.0 - nreldatewidth; } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
