summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-21 15:49:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-22 12:15:38 +0100
commit3fbbd74b7bc6aef4af5f0c4b23a73a6726b9afbf (patch)
treeb3a0df75c42a93645f5342863a7291c871e520eb /svx/source
parent4b7490fe49bb93f895e974602a2616fa80b74019 (diff)
loplugin:flatten in svx
Change-Id: Idc4d0186ecc6f0722c2b1358486a2430f037ae29 Reviewed-on: https://gerrit.libreoffice.org/45036 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx58
-rw-r--r--svx/source/dialog/ClassificationDialog.cxx76
-rw-r--r--svx/source/dialog/connctrl.cxx106
-rw-r--r--svx/source/dialog/framelink.cxx124
-rw-r--r--svx/source/dialog/imapwnd.cxx124
-rw-r--r--svx/source/dialog/langbox.cxx186
-rw-r--r--svx/source/engine3d/obj3d.cxx154
-rw-r--r--svx/source/engine3d/view3d.cxx418
-rw-r--r--svx/source/fmcomp/gridcell.cxx533
-rw-r--r--svx/source/fmcomp/gridctrl.cxx100
-rw-r--r--svx/source/form/fmobjfac.cxx48
-rw-r--r--svx/source/form/fmshimp.cxx126
-rw-r--r--svx/source/form/tbxform.cxx38
-rw-r--r--svx/source/gallery2/galbrws1.cxx34
-rw-r--r--svx/source/gallery2/galctrl.cxx86
-rw-r--r--svx/source/gallery2/galtheme.cxx264
-rw-r--r--svx/source/mnuctrls/smarttagmenu.cxx62
-rw-r--r--svx/source/sdr/overlay/overlaytools.cxx161
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx66
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx80
-rw-r--r--svx/source/svdraw/svddrgmt.cxx418
-rw-r--r--svx/source/svdraw/svdedtv1.cxx332
-rw-r--r--svx/source/svdraw/svdedtv2.cxx567
-rw-r--r--svx/source/svdraw/svdfmtf.cxx336
-rw-r--r--svx/source/svdraw/svdhdl.cxx162
-rw-r--r--svx/source/svdraw/svdmrkv.cxx526
-rw-r--r--svx/source/svdraw/svdogrp.cxx83
-rw-r--r--svx/source/svdraw/svdopath.cxx34
-rw-r--r--svx/source/svdraw/svdotext.cxx124
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx616
-rw-r--r--svx/source/svdraw/svdotxed.cxx35
-rw-r--r--svx/source/svdraw/svdpage.cxx35
-rw-r--r--svx/source/svdraw/svdpagv.cxx352
-rw-r--r--svx/source/svdraw/svdpntv.cxx76
-rw-r--r--svx/source/svdraw/svdtext.cxx72
-rw-r--r--svx/source/table/tablecontroller.cxx145
-rw-r--r--svx/source/tbxctrls/colrctrl.cxx36
-rw-r--r--svx/source/tbxctrls/itemwin.cxx94
-rw-r--r--svx/source/tbxctrls/layctrl.cxx58
-rw-r--r--svx/source/tbxctrls/linectrl.cxx72
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx130
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx80
-rw-r--r--svx/source/tbxctrls/tbxcolorupdate.cxx178
-rw-r--r--svx/source/unodraw/unoshape.cxx58
-rw-r--r--svx/source/xoutdev/_xpoly.cxx96
45 files changed, 3783 insertions, 3776 deletions
diff --git a/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
index 01fb333104c0..1e0ca231c092 100644
--- a/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
+++ b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
@@ -40,40 +40,40 @@ void VCLXAccessibleSvxFindReplaceDialog::FillAccessibleRelationSet( utl::Accessi
{
VCLXAccessibleComponent::FillAccessibleRelationSet( rRelationSet );
VclPtr<vcl::Window> pDlg = GetWindow();
- if ( pDlg )
+ if ( !pDlg )
+ return;
+
+ SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg.get() );
+ vcl::Window* pDocWin = pSrchDlg->GetDocWin();
+ if ( !pDocWin )
{
- SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg.get() );
- vcl::Window* pDocWin = pSrchDlg->GetDocWin();
- if ( !pDocWin )
- {
- return;
- }
- Reference < css::accessibility::XAccessible > xDocAcc = pDocWin->GetAccessible();
- if ( !xDocAcc.is() )
- {
- return;
- }
- Reference< css::accessibility::XAccessibleGetAccFlowTo > xGetAccFlowTo( xDocAcc, UNO_QUERY );
- if ( !xGetAccFlowTo.is() )
- {
- return;
- }
+ return;
+ }
+ Reference < css::accessibility::XAccessible > xDocAcc = pDocWin->GetAccessible();
+ if ( !xDocAcc.is() )
+ {
+ return;
+ }
+ Reference< css::accessibility::XAccessibleGetAccFlowTo > xGetAccFlowTo( xDocAcc, UNO_QUERY );
+ if ( !xGetAccFlowTo.is() )
+ {
+ return;
+ }
- const sal_Int32 FORFINDREPLACEFLOWTO = 2;
- uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->getAccFlowTo( Any(pSrchDlg->GetSrchFlag()), FORFINDREPLACEFLOWTO );
+ const sal_Int32 FORFINDREPLACEFLOWTO = 2;
+ uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->getAccFlowTo( Any(pSrchDlg->GetSrchFlag()), FORFINDREPLACEFLOWTO );
- sal_Int32 nLen = aAnySeq.getLength();
- if ( nLen )
+ sal_Int32 nLen = aAnySeq.getLength();
+ if ( nLen )
+ {
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence( nLen );
+ for ( sal_Int32 i = 0; i < nLen; i++ )
{
- uno::Sequence< uno::Reference< uno::XInterface > > aSequence( nLen );
- for ( sal_Int32 i = 0; i < nLen; i++ )
- {
- uno::Reference < css::accessibility::XAccessible > xAcc;
- aAnySeq[i] >>= xAcc;
- aSequence[i] = xAcc;
- }
- rRelationSet.AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence ) );
+ uno::Reference < css::accessibility::XAccessible > xAcc;
+ aAnySeq[i] >>= xAcc;
+ aSequence[i] = xAcc;
}
+ rRelationSet.AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence ) );
}
}
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx
index ad6d6ded5074..55dc11c86a50 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -575,55 +575,55 @@ std::vector<ClassificationResult> ClassificationDialog::getResult()
IMPL_LINK(ClassificationDialog, SelectClassificationHdl, ListBox&, rBox, void)
{
const sal_Int32 nSelected = rBox.GetSelectedEntryPos();
- if (nSelected >= 0 && m_nCurrentSelectedCategory != nSelected)
- {
- std::unique_ptr<EditTextObject> pEditText(m_pEditWindow->pEdEngine->CreateTextObject());
- std::vector<editeng::Section> aSections;
- pEditText->GetAllSections(aSections);
+ if (nSelected < 0 || m_nCurrentSelectedCategory == nSelected)
+ return;
+
+ std::unique_ptr<EditTextObject> pEditText(m_pEditWindow->pEdEngine->CreateTextObject());
+ std::vector<editeng::Section> aSections;
+ pEditText->GetAllSections(aSections);
- // if we are replacing an existing field
- bool bReplaceExisting = false;
- // selection of the existing field, which will be replaced
- ESelection aExistingFieldSelection;
+ // if we are replacing an existing field
+ bool bReplaceExisting = false;
+ // selection of the existing field, which will be replaced
+ ESelection aExistingFieldSelection;
- for (editeng::Section const & rSection : aSections)
+ for (editeng::Section const & rSection : aSections)
+ {
+ const SvxFieldItem* pFieldItem = findField(rSection);
+ if (pFieldItem)
{
- const SvxFieldItem* pFieldItem = findField(rSection);
- if (pFieldItem)
+ const ClassificationField* pClassificationField = dynamic_cast<const ClassificationField*>(pFieldItem->GetField());
+ if (pClassificationField && pClassificationField->meType == ClassificationType::CATEGORY)
{
- const ClassificationField* pClassificationField = dynamic_cast<const ClassificationField*>(pFieldItem->GetField());
- if (pClassificationField && pClassificationField->meType == ClassificationType::CATEGORY)
- {
- aExistingFieldSelection = ESelection(rSection.mnParagraph, rSection.mnStart,
- rSection.mnParagraph, rSection.mnEnd);
- bReplaceExisting = true;
- }
+ aExistingFieldSelection = ESelection(rSection.mnParagraph, rSection.mnStart,
+ rSection.mnParagraph, rSection.mnEnd);
+ bReplaceExisting = true;
}
}
+ }
- if (bReplaceExisting)
+ if (bReplaceExisting)
+ {
+ ScopedVclPtrInstance<QueryBox> aQueryBox(this, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, SvxResId(RID_CLASSIFICATION_CHANGE_CATEGORY));
+ if (aQueryBox->Execute() == RET_NO)
{
- ScopedVclPtrInstance<QueryBox> aQueryBox(this, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, SvxResId(RID_CLASSIFICATION_CHANGE_CATEGORY));
- if (aQueryBox->Execute() == RET_NO)
- {
- // Revert to previosuly selected
- m_pInternationalClassificationListBox->SelectEntryPos(m_nCurrentSelectedCategory);
- m_pClassificationListBox->SelectEntryPos(m_nCurrentSelectedCategory);
- return;
- }
- m_pEditWindow->pEdView->SetSelection(aExistingFieldSelection);
+ // Revert to previosuly selected
+ m_pInternationalClassificationListBox->SelectEntryPos(m_nCurrentSelectedCategory);
+ m_pClassificationListBox->SelectEntryPos(m_nCurrentSelectedCategory);
+ return;
}
+ m_pEditWindow->pEdView->SetSelection(aExistingFieldSelection);
+ }
- const OUString aFullString = maHelper.GetBACNames()[nSelected];
- const OUString aAbbreviatedString = maHelper.GetAbbreviatedBACNames()[nSelected];
- const OUString aIdentifierString = maHelper.GetBACIdentifiers()[nSelected];
- insertField(ClassificationType::CATEGORY, aAbbreviatedString, aFullString, aIdentifierString);
+ const OUString aFullString = maHelper.GetBACNames()[nSelected];
+ const OUString aAbbreviatedString = maHelper.GetAbbreviatedBACNames()[nSelected];
+ const OUString aIdentifierString = maHelper.GetBACIdentifiers()[nSelected];
+ insertField(ClassificationType::CATEGORY, aAbbreviatedString, aFullString, aIdentifierString);
- // Change category to the new selection
- m_pInternationalClassificationListBox->SelectEntryPos(nSelected);
- m_pClassificationListBox->SelectEntryPos(nSelected);
- m_nCurrentSelectedCategory = nSelected;
- }
+ // Change category to the new selection
+ m_pInternationalClassificationListBox->SelectEntryPos(nSelected);
+ m_pClassificationListBox->SelectEntryPos(nSelected);
+ m_nCurrentSelectedCategory = nSelected;
}
IMPL_LINK(ClassificationDialog, SelectMarkingHdl, ListBox&, rBox, void)
diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx
index 1acaa9db15ad..3828980f7dc0 100644
--- a/svx/source/dialog/connctrl.cxx
+++ b/svx/source/dialog/connctrl.cxx
@@ -76,67 +76,67 @@ Size SvxXConnectionPreview::GetOptimalSize() const
void SvxXConnectionPreview::AdaptSize()
{
// Adapt size
- if( pObjList )
- {
- SetMapMode(MapMode(MapUnit::Map100thMM));
+ if( !pObjList )
+ return;
- OutputDevice* pOD = pView->GetFirstOutputDevice(); // GetWin( 0 );
- tools::Rectangle aRect = pObjList->GetAllObjBoundRect();
+ SetMapMode(MapMode(MapUnit::Map100thMM));
- MapMode aMapMode = GetMapMode();
- aMapMode.SetMapUnit( pOD->GetMapMode().GetMapUnit() );
- SetMapMode( aMapMode );
-
- MapMode aDisplayMap( aMapMode );
- Point aNewPos;
- Size aNewSize;
- const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap );
- const long nWidth = aWinSize.Width();
- const long nHeight = aWinSize.Height();
- if (aRect.GetHeight() == 0)
- return;
- double fRectWH = (double) aRect.GetWidth() / aRect.GetHeight();
- if (nHeight == 0)
- return;
- double fWinWH = (double) nWidth / nHeight;
-
- // Adapt bitmap to Thumb size (not here!)
- if ( fRectWH < fWinWH)
- {
- aNewSize.Width() = (long) ( (double) nHeight * fRectWH );
- aNewSize.Height()= nHeight;
- }
- else
- {
- aNewSize.Width() = nWidth;
- aNewSize.Height()= (long) ( (double) nWidth / fRectWH );
- }
+ OutputDevice* pOD = pView->GetFirstOutputDevice(); // GetWin( 0 );
+ tools::Rectangle aRect = pObjList->GetAllObjBoundRect();
+
+ MapMode aMapMode = GetMapMode();
+ aMapMode.SetMapUnit( pOD->GetMapMode().GetMapUnit() );
+ SetMapMode( aMapMode );
+
+ MapMode aDisplayMap( aMapMode );
+ Point aNewPos;
+ Size aNewSize;
+ const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap );
+ const long nWidth = aWinSize.Width();
+ const long nHeight = aWinSize.Height();
+ if (aRect.GetHeight() == 0)
+ return;
+ double fRectWH = (double) aRect.GetWidth() / aRect.GetHeight();
+ if (nHeight == 0)
+ return;
+ double fWinWH = (double) nWidth / nHeight;
+
+ // Adapt bitmap to Thumb size (not here!)
+ if ( fRectWH < fWinWH)
+ {
+ aNewSize.Width() = (long) ( (double) nHeight * fRectWH );
+ aNewSize.Height()= nHeight;
+ }
+ else
+ {
+ aNewSize.Width() = nWidth;
+ aNewSize.Height()= (long) ( (double) nWidth / fRectWH );
+ }
- Fraction aFrac1( aWinSize.Width(), aRect.GetWidth() );
- Fraction aFrac2( aWinSize.Height(), aRect.GetHeight() );
- Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 );
+ Fraction aFrac1( aWinSize.Width(), aRect.GetWidth() );
+ Fraction aFrac2( aWinSize.Height(), aRect.GetHeight() );
+ Fraction aMinFrac( aFrac1 <= aFrac2 ? aFrac1 : aFrac2 );
- // Implement MapMode
- aDisplayMap.SetScaleX( aMinFrac );
- aDisplayMap.SetScaleY( aMinFrac );
+ // Implement MapMode
+ aDisplayMap.SetScaleX( aMinFrac );
+ aDisplayMap.SetScaleY( aMinFrac );
- // Centering
- aNewPos.X() = ( nWidth - aNewSize.Width() ) >> 1;
- aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1;
+ // Centering
+ aNewPos.X() = ( nWidth - aNewSize.Width() ) >> 1;
+ aNewPos.Y() = ( nHeight - aNewSize.Height() ) >> 1;
- aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMapMode, aDisplayMap ) );
- SetMapMode( aDisplayMap );
+ aDisplayMap.SetOrigin( LogicToLogic( aNewPos, aMapMode, aDisplayMap ) );
+ SetMapMode( aDisplayMap );
- // Origin
- aNewPos = aDisplayMap.GetOrigin();
- aNewPos -= Point( aRect.TopLeft().X(), aRect.TopLeft().Y() );
- aDisplayMap.SetOrigin( aNewPos );
- SetMapMode( aDisplayMap );
+ // Origin
+ aNewPos = aDisplayMap.GetOrigin();
+ aNewPos -= Point( aRect.TopLeft().X(), aRect.TopLeft().Y() );
+ aDisplayMap.SetOrigin( aNewPos );
+ SetMapMode( aDisplayMap );
- Point aPos;
- MouseEvent aMEvt( aPos, 1, MouseEventModifiers::NONE, MOUSE_RIGHT );
- MouseButtonDown( aMEvt );
- }
+ Point aPos;
+ MouseEvent aMEvt( aPos, 1, MouseEventModifiers::NONE, MOUSE_RIGHT );
+ MouseButtonDown( aMEvt );
}
void SvxXConnectionPreview::Construct()
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index f96c3b5e5f95..e86e6f1b3e34 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -711,77 +711,77 @@ void CreateBorderPrimitives(
// get offset color pairs for style, one per visible line
const StyleVectorCombination aCombination(rBorder, rX, 0.0, false, pForceColor);
- if(!aCombination.empty())
+ if(aCombination.empty())
+ return;
+
+ const basegfx::B2DVector aPerpendX(basegfx::getNormalizedPerpendicular(rX));
+ const bool bHasStartStyles(!rStartStyleVectorTable.empty());
+ const bool bHasEndStyles(!rEndStyleVectorTable.empty());
+ const size_t nOffsets(aCombination.size());
+ std::vector<ExtendSet> aExtendSetStart(nOffsets);
+ std::vector<ExtendSet> aExtendSetEnd(nOffsets);
+
+ if(bHasStartStyles)
{
- const basegfx::B2DVector aPerpendX(basegfx::getNormalizedPerpendicular(rX));
- const bool bHasStartStyles(!rStartStyleVectorTable.empty());
- const bool bHasEndStyles(!rEndStyleVectorTable.empty());
- const size_t nOffsets(aCombination.size());
- std::vector<ExtendSet> aExtendSetStart(nOffsets);
- std::vector<ExtendSet> aExtendSetEnd(nOffsets);
-
- if(bHasStartStyles)
- {
- // create extends for line starts, use given point/vector and offsets
- getExtends(aExtendSetStart, rOrigin, aCombination, aPerpendX, rStartStyleVectorTable.getEntries());
- }
+ // create extends for line starts, use given point/vector and offsets
+ getExtends(aExtendSetStart, rOrigin, aCombination, aPerpendX, rStartStyleVectorTable.getEntries());
+ }
- if(bHasEndStyles)
- {
- // Create extends for line ends, create inverse point/vector and inverse offsets.
- const StyleVectorCombination aMirroredCombination(rBorder, -rX, 0.0, true, pForceColor);
+ if(bHasEndStyles)
+ {
+ // Create extends for line ends, create inverse point/vector and inverse offsets.
+ const StyleVectorCombination aMirroredCombination(rBorder, -rX, 0.0, true, pForceColor);
- getExtends(aExtendSetEnd, rOrigin + rX, aMirroredCombination, -aPerpendX, rEndStyleVectorTable.getEntries());
+ getExtends(aExtendSetEnd, rOrigin + rX, aMirroredCombination, -aPerpendX, rEndStyleVectorTable.getEntries());
- // also need to inverse the result to apply to the correct lines
- std::reverse(aExtendSetEnd.begin(), aExtendSetEnd.end());
- }
+ // also need to inverse the result to apply to the correct lines
+ std::reverse(aExtendSetEnd.begin(), aExtendSetEnd.end());
+ }
- std::vector< drawinglayer::primitive2d::BorderLine > aBorderlines;
- const double fNegLength(-rX.getLength());
+ std::vector< drawinglayer::primitive2d::BorderLine > aBorderlines;
+ const double fNegLength(-rX.getLength());
- for(size_t a(0); a < nOffsets; a++)
+ for(size_t a(0); a < nOffsets; a++)
+ {
+ Color aMyColor;
+ double fMyOffset(0.0);
+ double fMyHalfWidth(0.0);
+ aCombination.getColorAndOffsetAndHalfWidth(a, aMyColor, fMyOffset, fMyHalfWidth);
+ const ExtendSet& rExtStart(aExtendSetStart[a]);
+ const ExtendSet& rExtEnd(aExtendSetEnd[a]);
+
+ if(0xff == aMyColor.GetTransparency())
{
- Color aMyColor;
- double fMyOffset(0.0);
- double fMyHalfWidth(0.0);
- aCombination.getColorAndOffsetAndHalfWidth(a, aMyColor, fMyOffset, fMyHalfWidth);
- const ExtendSet& rExtStart(aExtendSetStart[a]);
- const ExtendSet& rExtEnd(aExtendSetEnd[a]);
-
- if(0xff == aMyColor.GetTransparency())
- {
- aBorderlines.push_back(
- drawinglayer::primitive2d::BorderLine(
- fMyHalfWidth * 2.0));
- }
- else
- {
- aBorderlines.push_back(
- drawinglayer::primitive2d::BorderLine(
- drawinglayer::attribute::LineAttribute(
- aMyColor.getBColor(),
- fMyHalfWidth * 2.0),
- fNegLength * rExtStart.mfExtLeft,
- fNegLength * rExtStart.mfExtRight,
- fNegLength * rExtEnd.mfExtRight,
- fNegLength * rExtEnd.mfExtLeft));
- }
+ aBorderlines.push_back(
+ drawinglayer::primitive2d::BorderLine(
+ fMyHalfWidth * 2.0));
+ }
+ else
+ {
+ aBorderlines.push_back(
+ drawinglayer::primitive2d::BorderLine(
+ drawinglayer::attribute::LineAttribute(
+ aMyColor.getBColor(),
+ fMyHalfWidth * 2.0),
+ fNegLength * rExtStart.mfExtLeft,
+ fNegLength * rExtStart.mfExtRight,
+ fNegLength * rExtEnd.mfExtRight,
+ fNegLength * rExtEnd.mfExtLeft));
}
-
- static double fPatScFact(10.0); // 10.0 multiply, see old code
- const std::vector<double> aDashing(svtools::GetLineDashing(rBorder.Type(), rBorder.PatternScale() * fPatScFact));
- const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(aDashing);
- const basegfx::B2DPoint aStart(rOrigin + (aPerpendX * aCombination.getRefModeOffset()));
-
- rTarget.append(
- drawinglayer::primitive2d::Primitive2DReference(
- new drawinglayer::primitive2d::BorderLinePrimitive2D(
- aStart,
- aStart + rX,
- aBorderlines,
- aStrokeAttribute)));
}
+
+ static double fPatScFact(10.0); // 10.0 multiply, see old code
+ const std::vector<double> aDashing(svtools::GetLineDashing(rBorder.Type(), rBorder.PatternScale() * fPatScFact));
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(aDashing);
+ const basegfx::B2DPoint aStart(rOrigin + (aPerpendX * aCombination.getRefModeOffset()));
+
+ rTarget.append(
+ drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::BorderLinePrimitive2D(
+ aStart,
+ aStart + rX,
+ aBorderlines,
+ aStrokeAttribute)));
}
}
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 732abec9865a..693df0354491 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -632,30 +632,30 @@ void IMapWindow::DoMacroAssign()
{
SdrObject* pSdrObj = GetSelectedSdrObject();
- if ( pSdrObj )
- {
- SfxItemSet aSet( *pIMapPool, svl::Items<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG>{} );
+ if ( !pSdrObj )
+ return;
- SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
- aNamesItem.AddEvent( "MouseOver", "", SvMacroItemId::OnMouseOver );
- aNamesItem.AddEvent( "MouseOut", "", SvMacroItemId::OnMouseOut );
- aSet.Put( aNamesItem );
+ SfxItemSet aSet( *pIMapPool, svl::Items<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, SID_EVENTCONFIG, SID_EVENTCONFIG>{} );
- SvxMacroItem aMacroItem(SID_ATTR_MACROITEM);
- IMapObject* pIMapObj = GetIMapObj( pSdrObj );
- aMacroItem.SetMacroTable( pIMapObj->GetMacroTable() );
- aSet.Put( aMacroItem );
+ SfxEventNamesItem aNamesItem(SID_EVENTCONFIG);
+ aNamesItem.AddEvent( "MouseOver", "", SvMacroItemId::OnMouseOver );
+ aNamesItem.AddEvent( "MouseOut", "", SvMacroItemId::OnMouseOut );
+ aSet.Put( aNamesItem );
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateSfxDialog( this, aSet, mxDocumentFrame, SID_EVENTCONFIG ));
+ SvxMacroItem aMacroItem(SID_ATTR_MACROITEM);
+ IMapObject* pIMapObj = GetIMapObj( pSdrObj );
+ aMacroItem.SetMacroTable( pIMapObj->GetMacroTable() );
+ aSet.Put( aMacroItem );
- if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
- pIMapObj->SetMacroTable( static_cast<const SvxMacroItem& >(pOutSet->Get( SID_ATTR_MACROITEM )).GetMacroTable() );
- pModel->SetChanged();
- UpdateInfo( false );
- }
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateSfxDialog( this, aSet, mxDocumentFrame, SID_EVENTCONFIG ));
+
+ if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
+ pIMapObj->SetMacroTable( static_cast<const SvxMacroItem& >(pOutSet->Get( SID_ATTR_MACROITEM )).GetMacroTable() );
+ pModel->SetChanged();
+ UpdateInfo( false );
}
}
@@ -735,53 +735,53 @@ void IMapWindow::CreateDefaultObject()
{
SdrPageView* pPageView = pView->GetSdrPageView();
- if(pPageView)
+ if(!pPageView)
+ return;
+
+ // calc position and size
+ Point aPagePos(0, 0); // = pPageView->GetOffset();
+ Size aPageSize = pPageView->GetPage()->GetSize();
+ sal_uInt32 nDefaultObjectSizeWidth = aPageSize.Width() / 4;
+ sal_uInt32 nDefaultObjectSizeHeight = aPageSize.Height() / 4;
+ aPagePos.X() += (aPageSize.Width() / 2) - (nDefaultObjectSizeWidth / 2);
+ aPagePos.Y() += (aPageSize.Height() / 2) - (nDefaultObjectSizeHeight / 2);
+ tools::Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
+
+ SdrObject* pObj = SdrObjFactory::MakeNewObject( pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(), nullptr, pModel);
+ pObj->SetLogicRect(aNewObjectRectangle);
+
+ switch( pObj->GetObjIdentifier() )
{
- // calc position and size
- Point aPagePos(0, 0); // = pPageView->GetOffset();
- Size aPageSize = pPageView->GetPage()->GetSize();
- sal_uInt32 nDefaultObjectSizeWidth = aPageSize.Width() / 4;
- sal_uInt32 nDefaultObjectSizeHeight = aPageSize.Height() / 4;
- aPagePos.X() += (aPageSize.Width() / 2) - (nDefaultObjectSizeWidth / 2);
- aPagePos.Y() += (aPageSize.Height() / 2) - (nDefaultObjectSizeHeight / 2);
- tools::Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
-
- SdrObject* pObj = SdrObjFactory::MakeNewObject( pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(), nullptr, pModel);
- pObj->SetLogicRect(aNewObjectRectangle);
-
- switch( pObj->GetObjIdentifier() )
+ case OBJ_POLY:
+ case OBJ_PATHPOLY:
{
- case OBJ_POLY:
- case OBJ_PATHPOLY:
- {
- basegfx::B2DPolygon aInnerPoly;
- aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomLeft().X(), aNewObjectRectangle.BottomLeft().Y()));
- aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopLeft().X(), aNewObjectRectangle.TopLeft().Y()));
- aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopCenter().X(), aNewObjectRectangle.TopCenter().Y()));
- aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.Center().X(), aNewObjectRectangle.Center().Y()));
- aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.RightCenter().X(), aNewObjectRectangle.RightCenter().Y()));
- aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomRight().X(), aNewObjectRectangle.BottomRight().Y()));
- aInnerPoly.setClosed(true);
- static_cast<SdrPathObj*>(pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
- break;
- }
- case OBJ_FREEFILL:
- case OBJ_PATHFILL:
- {
- sal_Int32 nWdt(aNewObjectRectangle.GetWidth() / 2);
- sal_Int32 nHgt(aNewObjectRectangle.GetHeight() / 2);
- basegfx::B2DPolygon aInnerPoly(XPolygon(aNewObjectRectangle.Center(), nWdt, nHgt).getB2DPolygon());
- static_cast<SdrPathObj*>(pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
- break;
- }
-
+ basegfx::B2DPolygon aInnerPoly;
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomLeft().X(), aNewObjectRectangle.BottomLeft().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopLeft().X(), aNewObjectRectangle.TopLeft().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.TopCenter().X(), aNewObjectRectangle.TopCenter().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.Center().X(), aNewObjectRectangle.Center().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.RightCenter().X(), aNewObjectRectangle.RightCenter().Y()));
+ aInnerPoly.append(basegfx::B2DPoint(aNewObjectRectangle.BottomRight().X(), aNewObjectRectangle.BottomRight().Y()));
+ aInnerPoly.setClosed(true);
+ static_cast<SdrPathObj*>(pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
+ }
+ case OBJ_FREEFILL:
+ case OBJ_PATHFILL:
+ {
+ sal_Int32 nWdt(aNewObjectRectangle.GetWidth() / 2);
+ sal_Int32 nHgt(aNewObjectRectangle.GetHeight() / 2);
+ basegfx::B2DPolygon aInnerPoly(XPolygon(aNewObjectRectangle.Center(), nWdt, nHgt).getB2DPolygon());
+ static_cast<SdrPathObj*>(pObj)->SetPathPoly(basegfx::B2DPolyPolygon(aInnerPoly));
+ break;
}
- pView->InsertObjectAtView(pObj, *pPageView);
- SdrObjCreated( *pObj );
- SetCurrentObjState( true );
- pView->MarkObj( pObj, pPageView );
}
+
+ pView->InsertObjectAtView(pObj, *pPageView);
+ SdrObjCreated( *pObj );
+ SetCurrentObjState( true );
+ pView->MarkObj( pObj, pPageView );
}
void IMapWindow::SelectFirstObject()
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index 9ba9c5052b25..a50adec606d8 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -231,112 +231,112 @@ void SvxLanguageBoxBase::SetLanguageList( SvxLanguageListFlags nLangList,
m_bLangNoneIsLangAll = bLangNoneIsLangAll;
m_bWithCheckmark = bCheckSpellAvail;
- if ( SvxLanguageListFlags::EMPTY != nLangList )
+ if ( SvxLanguageListFlags::EMPTY == nLangList )
+ return;
+
+ bool bAddAvailable = (!(nLangList & SvxLanguageListFlags::ONLY_KNOWN) &&
+ ((nLangList & SvxLanguageListFlags::ALL) ||
+ (nLangList & SvxLanguageListFlags::WESTERN) ||
+ (nLangList & SvxLanguageListFlags::CTL) ||
+ (nLangList & SvxLanguageListFlags::CJK)));
+ std::vector< LanguageType > aSpellAvailLang;
+ std::vector< LanguageType > aHyphAvailLang;
+ std::vector< LanguageType > aThesAvailLang;
+ Sequence< sal_Int16 > aSpellUsedLang;
+ std::vector< LanguageType > aHyphUsedLang;
+ std::vector< LanguageType > aThesUsedLang;
+ Reference< XAvailableLocales > xAvail( LinguMgr::GetLngSvcMgr(), UNO_QUERY );
+ if (xAvail.is())
{
- bool bAddAvailable = (!(nLangList & SvxLanguageListFlags::ONLY_KNOWN) &&
- ((nLangList & SvxLanguageListFlags::ALL) ||
- (nLangList & SvxLanguageListFlags::WESTERN) ||
- (nLangList & SvxLanguageListFlags::CTL) ||
- (nLangList & SvxLanguageListFlags::CJK)));
- std::vector< LanguageType > aSpellAvailLang;
- std::vector< LanguageType > aHyphAvailLang;
- std::vector< LanguageType > aThesAvailLang;
- Sequence< sal_Int16 > aSpellUsedLang;
- std::vector< LanguageType > aHyphUsedLang;
- std::vector< LanguageType > aThesUsedLang;
- Reference< XAvailableLocales > xAvail( LinguMgr::GetLngSvcMgr(), UNO_QUERY );
- if (xAvail.is())
- {
- Sequence< css::lang::Locale > aTmp;
+ Sequence< css::lang::Locale > aTmp;
- if (bAddAvailable || (SvxLanguageListFlags::SPELL_AVAIL & nLangList))
- {
- aTmp = xAvail->getAvailableLocales( SN_SPELLCHECKER );
- aSpellAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
- }
- if (bAddAvailable || (SvxLanguageListFlags::HYPH_AVAIL & nLangList))
- {
- aTmp = xAvail->getAvailableLocales( SN_HYPHENATOR );
- aHyphAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
- }
- if (bAddAvailable || (SvxLanguageListFlags::THES_AVAIL & nLangList))
- {
- aTmp = xAvail->getAvailableLocales( SN_THESAURUS );
- aThesAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
- }
- }
- if (SvxLanguageListFlags::SPELL_USED & nLangList)
- {
- Reference< XSpellChecker1 > xTmp1( LinguMgr::GetSpellChecker(), UNO_QUERY );
- if (xTmp1.is())
- aSpellUsedLang = xTmp1->getLanguages();
- }
- if (SvxLanguageListFlags::HYPH_USED & nLangList)
+ if (bAddAvailable || (SvxLanguageListFlags::SPELL_AVAIL & nLangList))
{
- Reference< XHyphenator > xTmp( LinguMgr::GetHyphenator() );
- if (xTmp.is()) {
- Sequence < css::lang::Locale > aLocaleSequence( xTmp->getLocales() );
- aHyphUsedLang = lcl_LocaleSeqToLangSeq( aLocaleSequence );
- }
+ aTmp = xAvail->getAvailableLocales( SN_SPELLCHECKER );
+ aSpellAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
}
- if (SvxLanguageListFlags::THES_USED & nLangList)
+ if (bAddAvailable || (SvxLanguageListFlags::HYPH_AVAIL & nLangList))
{
- Reference< XThesaurus > xTmp( LinguMgr::GetThesaurus() );
- if (xTmp.is()) {
- Sequence < css::lang::Locale > aLocaleSequence( xTmp->getLocales() );
- aThesUsedLang = lcl_LocaleSeqToLangSeq( aLocaleSequence );
- }
+ aTmp = xAvail->getAvailableLocales( SN_HYPHENATOR );
+ aHyphAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
}
-
- std::vector<LanguageType> aKnown;
- sal_uInt32 nCount;
- if ( nLangList & SvxLanguageListFlags::ONLY_KNOWN )
+ if (bAddAvailable || (SvxLanguageListFlags::THES_AVAIL & nLangList))
{
- aKnown = LocaleDataWrapper::getInstalledLanguageTypes();
- nCount = aKnown.size();
+ aTmp = xAvail->getAvailableLocales( SN_THESAURUS );
+ aThesAvailLang = lcl_LocaleSeqToLangSeq( aTmp );
}
- else
- {
- nCount = SvtLanguageTable::GetLanguageEntryCount();
+ }
+ if (SvxLanguageListFlags::SPELL_USED & nLangList)
+ {
+ Reference< XSpellChecker1 > xTmp1( LinguMgr::GetSpellChecker(), UNO_QUERY );
+ if (xTmp1.is())
+ aSpellUsedLang = xTmp1->getLanguages();
+ }
+ if (SvxLanguageListFlags::HYPH_USED & nLangList)
+ {
+ Reference< XHyphenator > xTmp( LinguMgr::GetHyphenator() );
+ if (xTmp.is()) {
+ Sequence < css::lang::Locale > aLocaleSequence( xTmp->getLocales() );
+ aHyphUsedLang = lcl_LocaleSeqToLangSeq( aLocaleSequence );
}
- for ( sal_uInt32 i = 0; i < nCount; i++ )
- {
- LanguageType nLangType;
- if ( nLangList & SvxLanguageListFlags::ONLY_KNOWN )
- nLangType = aKnown[i];
- else
- nLangType = SvtLanguageTable::GetLanguageTypeAtIndex( i );
- if ( lcl_isPrerequisite( nLangType, nLangList) &&
- (lcl_isScriptTypeRequested( nLangType, nLangList) ||
- (bool(nLangList & SvxLanguageListFlags::FBD_CHARS) &&
- MsLangId::hasForbiddenCharacters(nLangType)) ||
- (bool(nLangList & SvxLanguageListFlags::SPELL_AVAIL) &&
- lcl_SeqHasLang(aSpellAvailLang, nLangType)) ||
- (bool(nLangList & SvxLanguageListFlags::HYPH_AVAIL) &&
- lcl_SeqHasLang(aHyphAvailLang, nLangType)) ||
- (bool(nLangList & SvxLanguageListFlags::THES_AVAIL) &&
- lcl_SeqHasLang(aThesAvailLang, nLangType)) ||
- (bool(nLangList & SvxLanguageListFlags::SPELL_USED) &&
- lcl_SeqHasLang(aSpellUsedLang, (sal_uInt16)nLangType)) ||
- (bool(nLangList & SvxLanguageListFlags::HYPH_USED) &&
- lcl_SeqHasLang(aHyphUsedLang, nLangType)) ||
- (bool(nLangList & SvxLanguageListFlags::THES_USED) &&
- lcl_SeqHasLang(aThesUsedLang, nLangType))) )
- InsertLanguage( nLangType );
+ }
+ if (SvxLanguageListFlags::THES_USED & nLangList)
+ {
+ Reference< XThesaurus > xTmp( LinguMgr::GetThesaurus() );
+ if (xTmp.is()) {
+ Sequence < css::lang::Locale > aLocaleSequence( xTmp->getLocales() );
+ aThesUsedLang = lcl_LocaleSeqToLangSeq( aLocaleSequence );
}
+ }
- if (bAddAvailable)
- {
- // Spell checkers, hyphenators and thesauri may add language tags
- // unknown so far.
- AddLanguages( aSpellAvailLang, nLangList);
- AddLanguages( aHyphAvailLang, nLangList);
- AddLanguages( aThesAvailLang, nLangList);
- }
+ std::vector<LanguageType> aKnown;
+ sal_uInt32 nCount;
+ if ( nLangList & SvxLanguageListFlags::ONLY_KNOWN )
+ {
+ aKnown = LocaleDataWrapper::getInstalledLanguageTypes();
+ nCount = aKnown.size();
+ }
+ else
+ {
+ nCount = SvtLanguageTable::GetLanguageEntryCount();
+ }
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ LanguageType nLangType;
+ if ( nLangList & SvxLanguageListFlags::ONLY_KNOWN )
+ nLangType = aKnown[i];
+ else
+ nLangType = SvtLanguageTable::GetLanguageTypeAtIndex( i );
+ if ( lcl_isPrerequisite( nLangType, nLangList) &&
+ (lcl_isScriptTypeRequested( nLangType, nLangList) ||
+ (bool(nLangList & SvxLanguageListFlags::FBD_CHARS) &&
+ MsLangId::hasForbiddenCharacters(nLangType)) ||
+ (bool(nLangList & SvxLanguageListFlags::SPELL_AVAIL) &&
+ lcl_SeqHasLang(aSpellAvailLang, nLangType)) ||
+ (bool(nLangList & SvxLanguageListFlags::HYPH_AVAIL) &&
+ lcl_SeqHasLang(aHyphAvailLang, nLangType)) ||
+ (bool(nLangList & SvxLanguageListFlags::THES_AVAIL) &&
+ lcl_SeqHasLang(aThesAvailLang, nLangType)) ||
+ (bool(nLangList & SvxLanguageListFlags::SPELL_USED) &&
+ lcl_SeqHasLang(aSpellUsedLang, (sal_uInt16)nLangType)) ||
+ (bool(nLangList & SvxLanguageListFlags::HYPH_USED) &&
+ lcl_SeqHasLang(aHyphUsedLang, nLangType)) ||
+ (bool(nLangList & SvxLanguageListFlags::THES_USED) &&
+ lcl_SeqHasLang(aThesUsedLang, nLangType))) )
+ InsertLanguage( nLangType );
+ }
- if (bHasLangNone)
- InsertLanguage( LANGUAGE_NONE );
+ if (bAddAvailable)
+ {
+ // Spell checkers, hyphenators and thesauri may add language tags
+ // unknown so far.
+ AddLanguages( aSpellAvailLang, nLangList);
+ AddLanguages( aHyphAvailLang, nLangList);
+ AddLanguages( aThesAvailLang, nLangList);
}
+
+ if (bHasLangNone)
+ InsertLanguage( LANGUAGE_NONE );
}
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 2aed4d22e4f8..f31f110b99f2 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -323,48 +323,48 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti
// Movement in X, Y in the eye coordinate system
E3dScene* pScene = GetScene();
- if(pScene)
- {
- // transform pos from 2D world to 3D eye
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
- const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
- basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y());
- basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
-
- aInverseSceneTransform.invert();
- aScaleCenter2D = aInverseSceneTransform * aScaleCenter2D;
-
- basegfx::B3DPoint aScaleCenter3D(aScaleCenter2D.getX(), aScaleCenter2D.getY(), 0.5);
- basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
-
- aInverseViewToEye.invert();
- aScaleCenter3D = aInverseViewToEye * aScaleCenter3D;
-
- // Get scale factors
- double fScaleX(xFact);
- double fScaleY(yFact);
-
- // build transform
- basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
- aInverseOrientation.invert();
- basegfx::B3DHomMatrix aFullTransform(GetFullTransform());
- basegfx::B3DHomMatrix aTrans(aFullTransform);
-
- aTrans *= aViewInfo3D.getOrientation();
- aTrans.translate(-aScaleCenter3D.getX(), -aScaleCenter3D.getY(), -aScaleCenter3D.getZ());
- aTrans.scale(fScaleX, fScaleY, 1.0);
- aTrans.translate(aScaleCenter3D.getX(), aScaleCenter3D.getY(), aScaleCenter3D.getZ());
- aTrans *= aInverseOrientation;
- aFullTransform.invert();
- aTrans *= aFullTransform;
-
- // Apply
- basegfx::B3DHomMatrix aObjTrans(GetTransform());
- aObjTrans *= aTrans;
-
- E3DModifySceneSnapRectUpdater aUpdater(this);
- SetTransform(aObjTrans);
- }
+ if(!pScene)
+ return;
+
+ // transform pos from 2D world to 3D eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y());
+ basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation());
+
+ aInverseSceneTransform.invert();
+ aScaleCenter2D = aInverseSceneTransform * aScaleCenter2D;
+
+ basegfx::B3DPoint aScaleCenter3D(aScaleCenter2D.getX(), aScaleCenter2D.getY(), 0.5);
+ basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection());
+
+ aInverseViewToEye.invert();
+ aScaleCenter3D = aInverseViewToEye * aScaleCenter3D;
+
+ // Get scale factors
+ double fScaleX(xFact);
+ double fScaleY(yFact);
+
+ // build transform
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aFullTransform(GetFullTransform());
+ basegfx::B3DHomMatrix aTrans(aFullTransform);
+
+ aTrans *= aViewInfo3D.getOrientation();
+ aTrans.translate(-aScaleCenter3D.getX(), -aScaleCenter3D.getY(), -aScaleCenter3D.getZ());
+ aTrans.scale(fScaleX, fScaleY, 1.0);
+ aTrans.translate(aScaleCenter3D.getX(), aScaleCenter3D.getY(), aScaleCenter3D.getZ());
+ aTrans *= aInverseOrientation;
+ aFullTransform.invert();
+ aTrans *= aFullTransform;
+
+ // Apply
+ basegfx::B3DHomMatrix aObjTrans(GetTransform());
+ aObjTrans *= aTrans;
+
+ E3DModifySceneSnapRectUpdater aUpdater(this);
+ SetTransform(aObjTrans);
}
@@ -375,49 +375,49 @@ void E3dObject::NbcMove(const Size& rSize)
// Movement in X, Y in the eye coordinate system
E3dScene* pScene = GetScene();
- if(pScene)
- {
- //Dimensions of the scene in 3D and 2D for comparison
- tools::Rectangle aRect = pScene->GetSnapRect();
+ if(!pScene)
+ return;
- basegfx::B3DHomMatrix aInvDispTransform;
- if(GetParentObj())
- {
- aInvDispTransform = GetParentObj()->GetFullTransform();
- aInvDispTransform.invert();
- }
+ //Dimensions of the scene in 3D and 2D for comparison
+ tools::Rectangle aRect = pScene->GetSnapRect();
- // BoundVolume from 3d world to 3d eye
- const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
- const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
- basegfx::B3DRange aEyeVol(pScene->GetBoundVolume());
- aEyeVol.transform(aViewInfo3D.getOrientation());
+ basegfx::B3DHomMatrix aInvDispTransform;
+ if(GetParentObj())
+ {
+ aInvDispTransform = GetParentObj()->GetFullTransform();
+ aInvDispTransform.invert();
+ }
- if ((aRect.GetWidth() == 0) || (aRect.GetHeight() == 0))
- throw o3tl::divide_by_zero();
+ // BoundVolume from 3d world to 3d eye
+ const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact());
+ const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D());
+ basegfx::B3DRange aEyeVol(pScene->GetBoundVolume());
+ aEyeVol.transform(aViewInfo3D.getOrientation());
- // build relative movement vector in eye coordinates
- basegfx::B3DPoint aMove(
- (double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(),
- (double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(),
- 0.0);
- basegfx::B3DPoint aPos(0.0, 0.0, 0.0);
+ if ((aRect.GetWidth() == 0) || (aRect.GetHeight() == 0))
+ throw o3tl::divide_by_zero();
- // movement vector to local coordinates of objects' parent
- basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
- aInverseOrientation.invert();
- basegfx::B3DHomMatrix aCompleteTrans(aInvDispTransform * aInverseOrientation);
+ // build relative movement vector in eye coordinates
+ basegfx::B3DPoint aMove(
+ (double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(),
+ (double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(),
+ 0.0);
+ basegfx::B3DPoint aPos(0.0, 0.0, 0.0);
- aMove = aCompleteTrans * aMove;
- aPos = aCompleteTrans * aPos;
+ // movement vector to local coordinates of objects' parent
+ basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation());
+ aInverseOrientation.invert();
+ basegfx::B3DHomMatrix aCompleteTrans(aInvDispTransform * aInverseOrientation);
- // build transformation and apply
- basegfx::B3DHomMatrix aTranslate;
- aTranslate.translate(aMove.getX() - aPos.getX(), aMove.getY() - aPos.getY(), aMove.getZ() - aPos.getZ());
+ aMove = aCompleteTrans * aMove;
+ aPos = aCompleteTrans * aPos;
- E3DModifySceneSnapRectUpdater aUpdater(pScene);
- SetTransform(aTranslate * GetTransform());
- }
+ // build transformation and apply
+ basegfx::B3DHomMatrix aTranslate;
+ aTranslate.translate(aMove.getX() - aPos.getX(), aMove.getY() - aPos.getY(), aMove.getZ() - aPos.getZ());
+
+ E3DModifySceneSnapRectUpdater aUpdater(pScene);
+ SetTransform(aTranslate * GetTransform());
}
// Return the sublist, but only if it contains objects!
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 2403e9b4431b..797588a097fe 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -827,172 +827,172 @@ void E3dView::ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, bool bExtrude
void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1, const basegfx::B2DPoint& rPnt2)
{
- if(AreObjectsMarked())
- {
- // Create undo
- if(bExtrude)
- BegUndo(SvxResId(RID_SVX_3D_UNDO_EXTRUDE));
- else
- BegUndo(SvxResId(RID_SVX_3D_UNDO_LATHE));
+ if(!AreObjectsMarked())
+ return;
- // Create a new scene for the created 3D object
- E3dScene* pScene = new E3dScene;
+ // Create undo
+ if(bExtrude)
+ BegUndo(SvxResId(RID_SVX_3D_UNDO_EXTRUDE));
+ else
+ BegUndo(SvxResId(RID_SVX_3D_UNDO_LATHE));
- // Determine rectangle and possibly correct it
- tools::Rectangle aRect = GetAllMarkedRect();
- if(aRect.GetWidth() <= 1)
- aRect.SetSize(Size(500, aRect.GetHeight()));
- if(aRect.GetHeight() <= 1)
- aRect.SetSize(Size(aRect.GetWidth(), 500));
+ // Create a new scene for the created 3D object
+ E3dScene* pScene = new E3dScene;
- // Determine the depth relative to the size of the selection
- double fDepth = 0.0;
- double fRot3D = 0.0;
- basegfx::B2DHomMatrix aLatheMat;
+ // Determine rectangle and possibly correct it
+ tools::Rectangle aRect = GetAllMarkedRect();
+ if(aRect.GetWidth() <= 1)
+ aRect.SetSize(Size(500, aRect.GetHeight()));
+ if(aRect.GetHeight() <= 1)
+ aRect.SetSize(Size(aRect.GetWidth(), 500));
- if(bExtrude)
- {
- double fW = (double)aRect.GetWidth();
- double fH = (double)aRect.GetHeight();
- fDepth = sqrt(fW*fW + fH*fH) / 6.0;
- }
- if(!bExtrude)
- {
- // Create transformation for the polygons rotating body
- if (rPnt1 != rPnt2)
- {
- // Rotation around control point #1 with set angle
- // for 3D coordinates
- basegfx::B2DPoint aDiff(rPnt1 - rPnt2);
- fRot3D = atan2(aDiff.getY(), aDiff.getX()) - F_PI2;
+ // Determine the depth relative to the size of the selection
+ double fDepth = 0.0;
+ double fRot3D = 0.0;
+ basegfx::B2DHomMatrix aLatheMat;
- if(basegfx::fTools::equalZero(fabs(fRot3D)))
- fRot3D = 0.0;
+ if(bExtrude)
+ {
+ double fW = (double)aRect.GetWidth();
+ double fH = (double)aRect.GetHeight();
+ fDepth = sqrt(fW*fW + fH*fH) / 6.0;
+ }
+ if(!bExtrude)
+ {
+ // Create transformation for the polygons rotating body
+ if (rPnt1 != rPnt2)
+ {
+ // Rotation around control point #1 with set angle
+ // for 3D coordinates
+ basegfx::B2DPoint aDiff(rPnt1 - rPnt2);
+ fRot3D = atan2(aDiff.getY(), aDiff.getX()) - F_PI2;
- if(fRot3D != 0.0)
- {
- aLatheMat = basegfx::utils::createRotateAroundPoint(rPnt2, -fRot3D)
- * aLatheMat;
- }
- }
+ if(basegfx::fTools::equalZero(fabs(fRot3D)))
+ fRot3D = 0.0;
- if (rPnt2.getX() != 0.0)
+ if(fRot3D != 0.0)
{
- // Translation to Y=0 - axis
- aLatheMat.translate(-rPnt2.getX(), 0.0);
+ aLatheMat = basegfx::utils::createRotateAroundPoint(rPnt2, -fRot3D)
+ * aLatheMat;
}
- else
- {
- aLatheMat.translate((double)-aRect.Left(), 0.0);
- }
-
- // Form the inverse matrix to determine the target expansion
- basegfx::B2DHomMatrix aInvLatheMat(aLatheMat);
- aInvLatheMat.invert();
+ }
- // SnapRect extension enables mirroring in the axis of rotation
- for(size_t a=0; a<GetMarkedObjectCount(); ++a)
- {
- SdrMark* pMark = GetSdrMarkByIndex(a);
- SdrObject* pObj = pMark->GetMarkedSdrObj();
- tools::Rectangle aTurnRect = pObj->GetSnapRect();
- basegfx::B2DPoint aRot;
- Point aRotPnt;
-
- aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Top());
- aRot *= aLatheMat;
- aRot.setX(-aRot.getX());
- aRot *= aInvLatheMat;
- aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
- aRect.Union(tools::Rectangle(aRotPnt, aRotPnt));
-
- aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Bottom());
- aRot *= aLatheMat;
- aRot.setX(-aRot.getX());
- aRot *= aInvLatheMat;
- aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
- aRect.Union(tools::Rectangle(aRotPnt, aRotPnt));
-
- aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Top());
- aRot *= aLatheMat;
- aRot.setX(-aRot.getX());
- aRot *= aInvLatheMat;
- aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
- aRect.Union(tools::Rectangle(aRotPnt, aRotPnt));
-
- aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Bottom());
- aRot *= aLatheMat;
- aRot.setX(-aRot.getX());
- aRot *= aInvLatheMat;
- aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
- aRect.Union(tools::Rectangle(aRotPnt, aRotPnt));
- }
+ if (rPnt2.getX() != 0.0)
+ {
+ // Translation to Y=0 - axis
+ aLatheMat.translate(-rPnt2.getX(), 0.0);
+ }
+ else
+ {
+ aLatheMat.translate((double)-aRect.Left(), 0.0);
}
- // Walk through the selection and convert it into 3D, complete with
- // Conversion to SdrPathObject, also fonts
+ // Form the inverse matrix to determine the target expansion
+ basegfx::B2DHomMatrix aInvLatheMat(aLatheMat);
+ aInvLatheMat.invert();
+
+ // SnapRect extension enables mirroring in the axis of rotation
for(size_t a=0; a<GetMarkedObjectCount(); ++a)
{
SdrMark* pMark = GetSdrMarkByIndex(a);
SdrObject* pObj = pMark->GetMarkedSdrObj();
-
- ImpCreate3DObject(pScene, pObj, bExtrude, fDepth, aLatheMat);
+ tools::Rectangle aTurnRect = pObj->GetSnapRect();
+ basegfx::B2DPoint aRot;
+ Point aRotPnt;
+
+ aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Top());
+ aRot *= aLatheMat;
+ aRot.setX(-aRot.getX());
+ aRot *= aInvLatheMat;
+ aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
+ aRect.Union(tools::Rectangle(aRotPnt, aRotPnt));
+
+ aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Bottom());
+ aRot *= aLatheMat;
+ aRot.setX(-aRot.getX());
+ aRot *= aInvLatheMat;
+ aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
+ aRect.Union(tools::Rectangle(aRotPnt, aRotPnt));
+
+ aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Top());
+ aRot *= aLatheMat;
+ aRot.setX(-aRot.getX());
+ aRot *= aInvLatheMat;
+ aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
+ aRect.Union(tools::Rectangle(aRotPnt, aRotPnt));
+
+ aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Bottom());
+ aRot *= aLatheMat;
+ aRot.setX(-aRot.getX());
+ aRot *= aInvLatheMat;
+ aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5));
+ aRect.Union(tools::Rectangle(aRotPnt, aRotPnt));
}
+ }
- if(pScene->GetSubList() && pScene->GetSubList()->GetObjCount() != 0)
- {
- // Arrange all created objects by depth
- if(bExtrude)
- DoDepthArrange(pScene, fDepth);
-
- // Center 3D objects in the middle of the overall rectangle
- basegfx::B3DPoint aCenter(pScene->GetBoundVolume().getCenter());
- basegfx::B3DHomMatrix aMatrix;
-
- aMatrix.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
- pScene->SetTransform(aMatrix * pScene->GetTransform());
-
- // Initialize scene
- pScene->NbcSetSnapRect(aRect);
- basegfx::B3DRange aBoundVol = pScene->GetBoundVolume();
- InitScene(pScene, (double)aRect.GetWidth(), (double)aRect.GetHeight(), aBoundVol.getDepth());
-
- // Insert scene instead of the first selected object and throw away
- // all the old objects
- SdrObject* pRepObj = GetMarkedObjectByIndex(0);
- SdrPageView* pPV = GetSdrPageViewOfMarkedByIndex(0);
- MarkObj(pRepObj, pPV, true);
- ReplaceObjectAtView(pRepObj, *pPV, pScene, false);
- DeleteMarked();
- MarkObj(pScene, pPV);
-
- // Rotate Rotation body around the axis of rotation
- basegfx::B3DHomMatrix aRotate;
-
- if(!bExtrude && fRot3D != 0.0)
- {
- aRotate.rotate(0.0, 0.0, fRot3D);
- }
+ // Walk through the selection and convert it into 3D, complete with
+ // Conversion to SdrPathObject, also fonts
+ for(size_t a=0; a<GetMarkedObjectCount(); ++a)
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ SdrObject* pObj = pMark->GetMarkedSdrObj();
- // Set default rotation
- aRotate.rotate(DEG2RAD(20.0), 0.0, 0.0);
+ ImpCreate3DObject(pScene, pObj, bExtrude, fDepth, aLatheMat);
+ }
- if(!aRotate.isIdentity())
- {
- pScene->SetTransform(aRotate * pScene->GetTransform());
- }
+ if(pScene->GetSubList() && pScene->GetSubList()->GetObjCount() != 0)
+ {
+ // Arrange all created objects by depth
+ if(bExtrude)
+ DoDepthArrange(pScene, fDepth);
+
+ // Center 3D objects in the middle of the overall rectangle
+ basegfx::B3DPoint aCenter(pScene->GetBoundVolume().getCenter());
+ basegfx::B3DHomMatrix aMatrix;
+
+ aMatrix.translate(-aCenter.getX(), -aCenter.getY(), -aCenter.getZ());
+ pScene->SetTransform(aMatrix * pScene->GetTransform());
+
+ // Initialize scene
+ pScene->NbcSetSnapRect(aRect);
+ basegfx::B3DRange aBoundVol = pScene->GetBoundVolume();
+ InitScene(pScene, (double)aRect.GetWidth(), (double)aRect.GetHeight(), aBoundVol.getDepth());
+
+ // Insert scene instead of the first selected object and throw away
+ // all the old objects
+ SdrObject* pRepObj = GetMarkedObjectByIndex(0);
+ SdrPageView* pPV = GetSdrPageViewOfMarkedByIndex(0);
+ MarkObj(pRepObj, pPV, true);
+ ReplaceObjectAtView(pRepObj, *pPV, pScene, false);
+ DeleteMarked();
+ MarkObj(pScene, pPV);
+
+ // Rotate Rotation body around the axis of rotation
+ basegfx::B3DHomMatrix aRotate;
- // Invalid SnapRects of objects
- pScene->SetSnapRect(aRect);
+ if(!bExtrude && fRot3D != 0.0)
+ {
+ aRotate.rotate(0.0, 0.0, fRot3D);
}
- else
+
+ // Set default rotation
+ aRotate.rotate(DEG2RAD(20.0), 0.0, 0.0);
+
+ if(!aRotate.isIdentity())
{
- // No 3D object was created, throw away everything
- delete pScene;
+ pScene->SetTransform(aRotate * pScene->GetTransform());
}
- EndUndo();
+ // Invalid SnapRects of objects
+ pScene->SetSnapRect(aRect);
}
+ else
+ {
+ // No 3D object was created, throw away everything
+ delete pScene;
+ }
+
+ EndUndo();
}
//Arrange all created extrude objects by depth
@@ -1325,92 +1325,92 @@ void E3dView::InitScene(E3dScene* pScene, double fW, double fH, double fCamZ)
void E3dView::Start3DCreation()
{
- if (GetMarkedObjectCount())
+ if (!GetMarkedObjectCount())
+ return;
+
+ //positioned
+ long nOutMin = 0;
+ long nOutMax = 0;
+ long nMinLen = 0;
+ long nObjDst = 0;
+ long nOutHgt = 0;
+ OutputDevice* pOut = GetFirstOutputDevice();
+
+ // first determine representation boundaries
+ if (pOut != nullptr)
{
- //positioned
- long nOutMin = 0;
- long nOutMax = 0;
- long nMinLen = 0;
- long nObjDst = 0;
- long nOutHgt = 0;
- OutputDevice* pOut = GetFirstOutputDevice();
-
- // first determine representation boundaries
- if (pOut != nullptr)
- {
- nMinLen = pOut->PixelToLogic(Size(0,50)).Height();
- nObjDst = pOut->PixelToLogic(Size(0,20)).Height();
+ nMinLen = pOut->PixelToLogic(Size(0,50)).Height();
+ nObjDst = pOut->PixelToLogic(Size(0,20)).Height();
- long nDst = pOut->PixelToLogic(Size(0,10)).Height();
+ long nDst = pOut->PixelToLogic(Size(0,10)).Height();
- nOutMin = -pOut->GetMapMode().GetOrigin().Y();
- nOutMax = pOut->GetOutputSize().Height() - 1 + nOutMin;
- nOutMin += nDst;
- nOutMax -= nDst;
+ nOutMin = -pOut->GetMapMode().GetOrigin().Y();
+ nOutMax = pOut->GetOutputSize().Height() - 1 + nOutMin;
+ nOutMin += nDst;
+ nOutMax -= nDst;
- if (nOutMax - nOutMin < nDst)
- {
- nOutMin += nOutMax + 1;
- nOutMin /= 2;
- nOutMin -= (nDst + 1) / 2;
- nOutMax = nOutMin + nDst;
- }
+ if (nOutMax - nOutMin < nDst)
+ {
+ nOutMin += nOutMax + 1;
+ nOutMin /= 2;
+ nOutMin -= (nDst + 1) / 2;
+ nOutMax = nOutMin + nDst;
+ }
- nOutHgt = nOutMax - nOutMin;
+ nOutHgt = nOutMax - nOutMin;
- long nTemp = nOutHgt / 4;
- if (nTemp > nMinLen) nMinLen = nTemp;
- }
+ long nTemp = nOutHgt / 4;
+ if (nTemp > nMinLen) nMinLen = nTemp;
+ }
- // and then attach the marks at the top and bottom of the object
- basegfx::B2DRange aR;
- for(size_t nMark = 0; nMark < GetMarkedObjectCount(); ++nMark)
- {
- SdrObject* pMark = GetMarkedObjectByIndex(nMark);
- basegfx::B2DPolyPolygon aXPP(pMark->TakeXorPoly());
- aR.expand(basegfx::utils::getRange(aXPP));
- }
+ // and then attach the marks at the top and bottom of the object
+ basegfx::B2DRange aR;
+ for(size_t nMark = 0; nMark < GetMarkedObjectCount(); ++nMark)
+ {
+ SdrObject* pMark = GetMarkedObjectByIndex(nMark);
+ basegfx::B2DPolyPolygon aXPP(pMark->TakeXorPoly());
+ aR.expand(basegfx::utils::getRange(aXPP));
+ }
- basegfx::B2DPoint aCenter(aR.getCenter());
- long nMarkHgt = basegfx::fround(aR.getHeight()) - 1;
- long nHgt = nMarkHgt + nObjDst * 2;
+ basegfx::B2DPoint aCenter(aR.getCenter());
+ long nMarkHgt = basegfx::fround(aR.getHeight()) - 1;
+ long nHgt = nMarkHgt + nObjDst * 2;
- if (nHgt < nMinLen) nHgt = nMinLen;
+ if (nHgt < nMinLen) nHgt = nMinLen;
- long nY1 = basegfx::fround(aCenter.getY()) - (nHgt + 1) / 2;
- long nY2 = nY1 + nHgt;
+ long nY1 = basegfx::fround(aCenter.getY()) - (nHgt + 1) / 2;
+ long nY2 = nY1 + nHgt;
- if (pOut && (nMinLen > nOutHgt)) nMinLen = nOutHgt;
- if (pOut)
+ if (pOut && (nMinLen > nOutHgt)) nMinLen = nOutHgt;
+ if (pOut)
+ {
+ if (nY1 < nOutMin)
{
- if (nY1 < nOutMin)
- {
- nY1 = nOutMin;
- if (nY2 < nY1 + nMinLen) nY2 = nY1 + nMinLen;
- }
- if (nY2 > nOutMax)
- {
- nY2 = nOutMax;
- if (nY1 > nY2 - nMinLen) nY1 = nY2 - nMinLen;
- }
+ nY1 = nOutMin;
+ if (nY2 < nY1 + nMinLen) nY2 = nY1 + nMinLen;
}
+ if (nY2 > nOutMax)
+ {
+ nY2 = nOutMax;
+ if (nY1 > nY2 - nMinLen) nY1 = nY2 - nMinLen;
+ }
+ }
- maRef1.X() = basegfx::fround(aR.getMinX()); // Initial move axis 2/100mm to the left
- maRef1.Y() = nY1;
- maRef2.X() = maRef1.X();
- maRef2.Y() = nY2;
+ maRef1.X() = basegfx::fround(aR.getMinX()); // Initial move axis 2/100mm to the left
+ maRef1.Y() = nY1;
+ maRef2.X() = maRef1.X();
+ maRef2.Y() = nY2;
- // Turn on marks
- SetMarkHandles(nullptr);
+ // Turn on marks
+ SetMarkHandles(nullptr);
- //HMHif (bVis) ShowMarkHdl();
- if (AreObjectsMarked()) MarkListHasChanged();
+ //HMHif (bVis) ShowMarkHdl();
+ if (AreObjectsMarked()) MarkListHasChanged();
- // Show mirror polygon IMMEDIATELY
- const SdrHdlList &aHdlList = GetHdlList();
- mpMirrorOverlay = new Impl3DMirrorConstructOverlay(*this);
- mpMirrorOverlay->SetMirrorAxis(aHdlList.GetHdl(SdrHdlKind::Ref1)->GetPos(), aHdlList.GetHdl(SdrHdlKind::Ref2)->GetPos());
- }
+ // Show mirror polygon IMMEDIATELY
+ const SdrHdlList &aHdlList = GetHdlList();
+ mpMirrorOverlay = new Impl3DMirrorConstructOverlay(*this);
+ mpMirrorOverlay->SetMirrorAxis(aHdlList.GetHdl(SdrHdlKind::Ref1)->GetPos(), aHdlList.GetHdl(SdrHdlKind::Ref2)->GetPos());
}
// what happens with a mouse movement when the object is created?
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 9ae075f7099f..7da52af19012 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -535,44 +535,44 @@ DbCellControl::DbCellControl( DbGridColumn& _rColumn )
,m_pWindow( nullptr )
{
Reference< XPropertySet > xColModelProps( _rColumn.getModel(), UNO_QUERY );
- if ( xColModelProps.is() )
- {
- // if our model's format key changes we want to propagate the new value to our windows
- m_pModelChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, Reference< css::beans::XPropertySet > (_rColumn.getModel(), UNO_QUERY));
-
- // be listener for some common properties
- implDoPropertyListening( FM_PROP_READONLY, false );
- implDoPropertyListening( FM_PROP_ENABLED, false );
-
- // add as listener for all known "value" properties
- implDoPropertyListening( FM_PROP_VALUE, false );
- implDoPropertyListening( FM_PROP_STATE, false );
- implDoPropertyListening( FM_PROP_TEXT, false );
- implDoPropertyListening( FM_PROP_EFFECTIVE_VALUE, false );
- implDoPropertyListening( FM_PROP_SELECT_SEQ, false );
- implDoPropertyListening( FM_PROP_DATE, false );
- implDoPropertyListening( FM_PROP_TIME, false );
+ if ( !xColModelProps.is() )
+ return;
- // be listener at the bound field as well
- try
+ // if our model's format key changes we want to propagate the new value to our windows
+ m_pModelChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, Reference< css::beans::XPropertySet > (_rColumn.getModel(), UNO_QUERY));
+
+ // be listener for some common properties
+ implDoPropertyListening( FM_PROP_READONLY, false );
+ implDoPropertyListening( FM_PROP_ENABLED, false );
+
+ // add as listener for all known "value" properties
+ implDoPropertyListening( FM_PROP_VALUE, false );
+ implDoPropertyListening( FM_PROP_STATE, false );
+ implDoPropertyListening( FM_PROP_TEXT, false );
+ implDoPropertyListening( FM_PROP_EFFECTIVE_VALUE, false );
+ implDoPropertyListening( FM_PROP_SELECT_SEQ, false );
+ implDoPropertyListening( FM_PROP_DATE, false );
+ implDoPropertyListening( FM_PROP_TIME, false );
+
+ // be listener at the bound field as well
+ try
+ {
+ Reference< XPropertySetInfo > xPSI( xColModelProps->getPropertySetInfo(), UNO_SET_THROW );
+ if ( xPSI->hasPropertyByName( FM_PROP_BOUNDFIELD ) )
{
- Reference< XPropertySetInfo > xPSI( xColModelProps->getPropertySetInfo(), UNO_SET_THROW );
- if ( xPSI->hasPropertyByName( FM_PROP_BOUNDFIELD ) )
+ Reference< XPropertySet > xField;
+ xColModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ) >>= xField;
+ if ( xField.is() )
{
- Reference< XPropertySet > xField;
- xColModelProps->getPropertyValue( FM_PROP_BOUNDFIELD ) >>= xField;
- if ( xField.is() )
- {
- m_pFieldChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, xField);
- m_pFieldChangeBroadcaster->addProperty( FM_PROP_ISREADONLY );
- }
+ m_pFieldChangeBroadcaster = new ::comphelper::OPropertyChangeMultiplexer(this, xField);
+ m_pFieldChangeBroadcaster->addProperty( FM_PROP_ISREADONLY );
}
}
- catch( const Exception& )
- {
- OSL_FAIL( "DbCellControl::doPropertyListening: caught an exception!" );
- DBG_UNHANDLED_EXCEPTION();
- }
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "DbCellControl::doPropertyListening: caught an exception!" );
+ DBG_UNHANDLED_EXCEPTION();
}
}
@@ -1718,23 +1718,23 @@ void DbPatternField::implAdjustGenericFieldSetting( const Reference< XPropertySe
{
DBG_ASSERT( m_pWindow, "DbPatternField::implAdjustGenericFieldSetting: not to be called without window!" );
DBG_ASSERT( _rxModel.is(), "DbPatternField::implAdjustGenericFieldSetting: invalid model!" );
- if ( m_pWindow && _rxModel.is() )
- {
- OUString aLitMask;
- OUString aEditMask;
- bool bStrict = false;
+ if ( !m_pWindow || !_rxModel.is() )
+ return;
- _rxModel->getPropertyValue( FM_PROP_LITERALMASK ) >>= aLitMask;
- _rxModel->getPropertyValue( FM_PROP_EDITMASK ) >>= aEditMask;
- _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) >>= bStrict;
+ OUString aLitMask;
+ OUString aEditMask;
+ bool bStrict = false;
- OString aAsciiEditMask(OUStringToOString(aEditMask, RTL_TEXTENCODING_ASCII_US));
+ _rxModel->getPropertyValue( FM_PROP_LITERALMASK ) >>= aLitMask;
+ _rxModel->getPropertyValue( FM_PROP_EDITMASK ) >>= aEditMask;
+ _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) >>= bStrict;
- static_cast< PatternField* >( m_pWindow.get() )->SetMask( aAsciiEditMask, aLitMask );
- static_cast< PatternField* >( m_pPainter.get() )->SetMask( aAsciiEditMask, aLitMask );
- static_cast< PatternField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
- static_cast< PatternField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
- }
+ OString aAsciiEditMask(OUStringToOString(aEditMask, RTL_TEXTENCODING_ASCII_US));
+
+ static_cast< PatternField* >( m_pWindow.get() )->SetMask( aAsciiEditMask, aLitMask );
+ static_cast< PatternField* >( m_pPainter.get() )->SetMask( aAsciiEditMask, aLitMask );
+ static_cast< PatternField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
+ static_cast< PatternField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
}
@@ -1865,54 +1865,54 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe
{
DBG_ASSERT( m_pWindow, "DbNumericField::implAdjustGenericFieldSetting: not to be called without window!" );
DBG_ASSERT( _rxModel.is(), "DbNumericField::implAdjustGenericFieldSetting: invalid model!" );
- if ( m_pWindow && _rxModel.is() )
+ if ( !m_pWindow || !_rxModel.is() )
+ return;
+
+ sal_Int32 nMin = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMIN ) );
+ sal_Int32 nMax = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMAX ) );
+ sal_Int32 nStep = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUESTEP ) );
+ bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
+ sal_Int16 nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) );
+ bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) );
+
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetMinValue(nMin);
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetMaxValue(nMax);
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetSpinSize(nStep);
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetStrictFormat(bStrict);
+
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetMinValue(nMin);
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetMaxValue(nMax);
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetStrictFormat(bStrict);
+
+
+ // give a formatter to the field and the painter;
+ // test first if I can get from the service behind a connection
+ Reference< css::util::XNumberFormatsSupplier > xSupplier;
+ Reference< XRowSet > xForm;
+ if ( m_rColumn.GetParent().getDataSource() )
+ xForm.set( Reference< XInterface >(*m_rColumn.GetParent().getDataSource()), UNO_QUERY );
+ if ( xForm.is() )
+ xSupplier = getNumberFormats( getConnection( xForm ), true );
+ SvNumberFormatter* pFormatterUsed = nullptr;
+ if ( xSupplier.is() )
{
- sal_Int32 nMin = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMIN ) );
- sal_Int32 nMax = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMAX ) );
- sal_Int32 nStep = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUESTEP ) );
- bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
- sal_Int16 nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) );
- bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) );
-
- static_cast< DoubleNumericField* >( m_pWindow.get() )->SetMinValue(nMin);
- static_cast< DoubleNumericField* >( m_pWindow.get() )->SetMaxValue(nMax);
- static_cast< DoubleNumericField* >( m_pWindow.get() )->SetSpinSize(nStep);
- static_cast< DoubleNumericField* >( m_pWindow.get() )->SetStrictFormat(bStrict);
-
- static_cast< DoubleNumericField* >( m_pPainter.get() )->SetMinValue(nMin);
- static_cast< DoubleNumericField* >( m_pPainter.get() )->SetMaxValue(nMax);
- static_cast< DoubleNumericField* >( m_pPainter.get() )->SetStrictFormat(bStrict);
-
-
- // give a formatter to the field and the painter;
- // test first if I can get from the service behind a connection
- Reference< css::util::XNumberFormatsSupplier > xSupplier;
- Reference< XRowSet > xForm;
- if ( m_rColumn.GetParent().getDataSource() )
- xForm.set( Reference< XInterface >(*m_rColumn.GetParent().getDataSource()), UNO_QUERY );
- if ( xForm.is() )
- xSupplier = getNumberFormats( getConnection( xForm ), true );
- SvNumberFormatter* pFormatterUsed = nullptr;
- if ( xSupplier.is() )
- {
- SvNumberFormatsSupplierObj* pImplmentation = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
- pFormatterUsed = pImplmentation ? pImplmentation->GetNumberFormatter() : nullptr;
- }
- if ( nullptr == pFormatterUsed )
- { // the cursor didn't lead to success -> standard
- pFormatterUsed = static_cast< DoubleNumericField* >( m_pWindow.get() )->StandardFormatter();
- DBG_ASSERT( pFormatterUsed != nullptr, "DbNumericField::implAdjustGenericFieldSetting: no standard formatter given by the numeric field !" );
- }
- static_cast< DoubleNumericField* >( m_pWindow.get() )->SetFormatter( pFormatterUsed );
- static_cast< DoubleNumericField* >( m_pPainter.get() )->SetFormatter( pFormatterUsed );
+ SvNumberFormatsSupplierObj* pImplmentation = SvNumberFormatsSupplierObj::getImplementation( xSupplier );
+ pFormatterUsed = pImplmentation ? pImplmentation->GetNumberFormatter() : nullptr;
+ }
+ if ( nullptr == pFormatterUsed )
+ { // the cursor didn't lead to success -> standard
+ pFormatterUsed = static_cast< DoubleNumericField* >( m_pWindow.get() )->StandardFormatter();
+ DBG_ASSERT( pFormatterUsed != nullptr, "DbNumericField::implAdjustGenericFieldSetting: no standard formatter given by the numeric field !" );
+ }
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetFormatter( pFormatterUsed );
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetFormatter( pFormatterUsed );
- // and then generate a format which has the desired length after the decimal point, etc.
- LanguageType aAppLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType();
- OUString sFormatString = pFormatterUsed->GenerateFormat(0, aAppLanguage, bThousand, false, nScale);
+ // and then generate a format which has the desired length after the decimal point, etc.
+ LanguageType aAppLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType();
+ OUString sFormatString = pFormatterUsed->GenerateFormat(0, aAppLanguage, bThousand, false, nScale);
- static_cast< DoubleNumericField* >( m_pWindow.get() )->SetFormat( sFormatString, aAppLanguage );
- static_cast< DoubleNumericField* >( m_pPainter.get() )->SetFormat( sFormatString, aAppLanguage );
- }
+ static_cast< DoubleNumericField* >( m_pWindow.get() )->SetFormat( sFormatString, aAppLanguage );
+ static_cast< DoubleNumericField* >( m_pPainter.get() )->SetFormat( sFormatString, aAppLanguage );
}
@@ -2005,42 +2005,42 @@ void DbCurrencyField::implAdjustGenericFieldSetting( const Reference< XPropertyS
{
DBG_ASSERT( m_pWindow, "DbCurrencyField::implAdjustGenericFieldSetting: not to be called without window!" );
DBG_ASSERT( _rxModel.is(), "DbCurrencyField::implAdjustGenericFieldSetting: invalid model!" );
- if ( m_pWindow && _rxModel.is() )
- {
- m_nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) );
- double nMin = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMIN ) );
- double nMax = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMAX ) );
- double nStep = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUESTEP ) );
- bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
- bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) );
- OUString aStr( getString( _rxModel->getPropertyValue(FM_PROP_CURRENCYSYMBOL ) ) );
-
- //fdo#42747 the min/max/first/last of vcl NumericFormatters needs to be
- //multiplied by the no of decimal places. See also
- //VclBuilder::mungeAdjustment
- int nMul = rtl_math_pow10Exp(1, m_nScale);
- nMin *= nMul;
- nMax *= nMul;
-
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetUseThousandSep( bThousand );
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetDecimalDigits( m_nScale );
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetCurrencySymbol( aStr );
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetFirst( nMin );
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetLast( nMax );
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetMin( nMin );
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetMax( nMax );
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetSpinSize( nStep );
- static_cast< LongCurrencyField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
-
- static_cast< LongCurrencyField* >( m_pPainter.get() )->SetUseThousandSep( bThousand );
- static_cast< LongCurrencyField* >( m_pPainter.get() )->SetDecimalDigits( m_nScale );
- static_cast< LongCurrencyField* >( m_pPainter.get() )->SetCurrencySymbol( aStr );
- static_cast< LongCurrencyField* >( m_pPainter.get() )->SetFirst( nMin );
- static_cast< LongCurrencyField* >( m_pPainter.get() )->SetLast( nMax );
- static_cast< LongCurrencyField* >( m_pPainter.get() )->SetMin( nMin );
- static_cast< LongCurrencyField* >( m_pPainter.get() )->SetMax( nMax );
- static_cast< LongCurrencyField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
- }
+ if ( !m_pWindow || !_rxModel.is() )
+ return;
+
+ m_nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) );
+ double nMin = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMIN ) );
+ double nMax = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMAX ) );
+ double nStep = getDouble( _rxModel->getPropertyValue( FM_PROP_VALUESTEP ) );
+ bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
+ bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) );
+ OUString aStr( getString( _rxModel->getPropertyValue(FM_PROP_CURRENCYSYMBOL ) ) );
+
+ //fdo#42747 the min/max/first/last of vcl NumericFormatters needs to be
+ //multiplied by the no of decimal places. See also
+ //VclBuilder::mungeAdjustment
+ int nMul = rtl_math_pow10Exp(1, m_nScale);
+ nMin *= nMul;
+ nMax *= nMul;
+
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetUseThousandSep( bThousand );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetDecimalDigits( m_nScale );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetCurrencySymbol( aStr );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetFirst( nMin );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetLast( nMax );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetMin( nMin );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetMax( nMax );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetSpinSize( nStep );
+ static_cast< LongCurrencyField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
+
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetUseThousandSep( bThousand );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetDecimalDigits( m_nScale );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetCurrencySymbol( aStr );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetFirst( nMin );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetLast( nMax );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetMin( nMin );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetMax( nMax );
+ static_cast< LongCurrencyField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
}
@@ -2171,36 +2171,36 @@ void DbDateField::implAdjustGenericFieldSetting( const Reference< XPropertySet >
{
DBG_ASSERT( m_pWindow, "DbDateField::implAdjustGenericFieldSetting: not to be called without window!" );
DBG_ASSERT( _rxModel.is(), "DbDateField::implAdjustGenericFieldSetting: invalid model!" );
- if ( m_pWindow && _rxModel.is() )
- {
- sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_DATEFORMAT ) );
- util::Date aMin;
- OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_DATEMIN ) >>= aMin );
- util::Date aMax;
- OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_DATEMAX ) >>= aMax );
- bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
+ if ( !m_pWindow || !_rxModel.is() )
+ return;
- Any aCentury = _rxModel->getPropertyValue( FM_PROP_DATE_SHOW_CENTURY );
- if ( aCentury.getValueType().getTypeClass() != TypeClass_VOID )
- {
- bool bShowDateCentury = getBOOL( aCentury );
+ sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_DATEFORMAT ) );
+ util::Date aMin;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_DATEMIN ) >>= aMin );
+ util::Date aMax;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_DATEMAX ) >>= aMax );
+ bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
- static_cast<DateField*>( m_pWindow.get() )->SetShowDateCentury( bShowDateCentury );
- static_cast<DateField*>( m_pPainter.get() )->SetShowDateCentury( bShowDateCentury );
- }
-
- static_cast< DateField* >( m_pWindow.get() )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
- static_cast< DateField* >( m_pWindow.get() )->SetMin( aMin );
- static_cast< DateField* >( m_pWindow.get() )->SetMax( aMax );
- static_cast< DateField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
- static_cast< DateField* >( m_pWindow.get() )->EnableEmptyFieldValue( true );
+ Any aCentury = _rxModel->getPropertyValue( FM_PROP_DATE_SHOW_CENTURY );
+ if ( aCentury.getValueType().getTypeClass() != TypeClass_VOID )
+ {
+ bool bShowDateCentury = getBOOL( aCentury );
- static_cast< DateField* >( m_pPainter.get() )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
- static_cast< DateField* >( m_pPainter.get() )->SetMin( aMin );
- static_cast< DateField* >( m_pPainter.get() )->SetMax( aMax );
- static_cast< DateField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
- static_cast< DateField* >( m_pPainter.get() )->EnableEmptyFieldValue( true );
+ static_cast<DateField*>( m_pWindow.get() )->SetShowDateCentury( bShowDateCentury );
+ static_cast<DateField*>( m_pPainter.get() )->SetShowDateCentury( bShowDateCentury );
}
+
+ static_cast< DateField* >( m_pWindow.get() )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
+ static_cast< DateField* >( m_pWindow.get() )->SetMin( aMin );
+ static_cast< DateField* >( m_pWindow.get() )->SetMax( aMax );
+ static_cast< DateField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
+ static_cast< DateField* >( m_pWindow.get() )->EnableEmptyFieldValue( true );
+
+ static_cast< DateField* >( m_pPainter.get() )->SetExtDateFormat( (ExtDateFieldFormat)nFormat );
+ static_cast< DateField* >( m_pPainter.get() )->SetMin( aMin );
+ static_cast< DateField* >( m_pPainter.get() )->SetMax( aMax );
+ static_cast< DateField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
+ static_cast< DateField* >( m_pPainter.get() )->EnableEmptyFieldValue( true );
}
namespace
@@ -2288,27 +2288,27 @@ void DbTimeField::implAdjustGenericFieldSetting( const Reference< XPropertySet >
{
DBG_ASSERT( m_pWindow, "DbTimeField::implAdjustGenericFieldSetting: not to be called without window!" );
DBG_ASSERT( _rxModel.is(), "DbTimeField::implAdjustGenericFieldSetting: invalid model!" );
- if ( m_pWindow && _rxModel.is() )
- {
- sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_TIMEFORMAT ) );
- util::Time aMin;
- OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_TIMEMIN ) >>= aMin );
- util::Time aMax;
- OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_TIMEMAX ) >>= aMax );
- bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
+ if ( !m_pWindow || !_rxModel.is() )
+ return;
- static_cast< TimeField* >( m_pWindow.get() )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
- static_cast< TimeField* >( m_pWindow.get() )->SetMin( aMin );
- static_cast< TimeField* >( m_pWindow.get() )->SetMax( aMax );
- static_cast< TimeField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
- static_cast< TimeField* >( m_pWindow.get() )->EnableEmptyFieldValue( true );
+ sal_Int16 nFormat = getINT16( _rxModel->getPropertyValue( FM_PROP_TIMEFORMAT ) );
+ util::Time aMin;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_TIMEMIN ) >>= aMin );
+ util::Time aMax;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_TIMEMAX ) >>= aMax );
+ bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) );
- static_cast< TimeField* >( m_pPainter.get() )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
- static_cast< TimeField* >( m_pPainter.get() )->SetMin( aMin );
- static_cast< TimeField* >( m_pPainter.get() )->SetMax( aMax );
- static_cast< TimeField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
- static_cast< TimeField* >( m_pPainter.get() )->EnableEmptyFieldValue( true );
- }
+ static_cast< TimeField* >( m_pWindow.get() )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
+ static_cast< TimeField* >( m_pWindow.get() )->SetMin( aMin );
+ static_cast< TimeField* >( m_pWindow.get() )->SetMax( aMax );
+ static_cast< TimeField* >( m_pWindow.get() )->SetStrictFormat( bStrict );
+ static_cast< TimeField* >( m_pWindow.get() )->EnableEmptyFieldValue( true );
+
+ static_cast< TimeField* >( m_pPainter.get() )->SetExtFormat( (ExtTimeFieldFormat)nFormat );
+ static_cast< TimeField* >( m_pPainter.get() )->SetMin( aMin );
+ static_cast< TimeField* >( m_pPainter.get() )->SetMax( aMax );
+ static_cast< TimeField* >( m_pPainter.get() )->SetStrictFormat( bStrict );
+ static_cast< TimeField* >( m_pPainter.get() )->EnableEmptyFieldValue( true );
}
namespace
@@ -2956,118 +2956,119 @@ void DbFilterField::SetText(const OUString& rText)
void DbFilterField::Update()
{
// should we fill the combobox with a filter proposal?
- if (m_bFilterList && !m_bFilterListFilled)
- {
- m_bFilterListFilled = true;
- Reference< css::beans::XPropertySet > xField = m_rColumn.GetField();
- if (!xField.is())
- return;
+ if (!m_bFilterList || m_bFilterListFilled)
+ return;
- OUString aName;
- xField->getPropertyValue(FM_PROP_NAME) >>= aName;
+ m_bFilterListFilled = true;
+ Reference< css::beans::XPropertySet > xField = m_rColumn.GetField();
+ if (!xField.is())
+ return;
- // the columnmodel
- Reference< css::container::XChild > xModelAsChild(m_rColumn.getModel(), UNO_QUERY);
- // the grid model
- xModelAsChild.set(xModelAsChild->getParent(),UNO_QUERY);
- Reference< XRowSet > xForm(xModelAsChild->getParent(), UNO_QUERY);
- if (!xForm.is())
- return;
+ OUString aName;
+ xField->getPropertyValue(FM_PROP_NAME) >>= aName;
- Reference<XPropertySet> xFormProp(xForm,UNO_QUERY);
- Reference< XTablesSupplier > xSupTab;
- xFormProp->getPropertyValue("SingleSelectQueryComposer") >>= xSupTab;
+ // the columnmodel
+ Reference< css::container::XChild > xModelAsChild(m_rColumn.getModel(), UNO_QUERY);
+ // the grid model
+ xModelAsChild.set(xModelAsChild->getParent(),UNO_QUERY);
+ Reference< XRowSet > xForm(xModelAsChild->getParent(), UNO_QUERY);
+ if (!xForm.is())
+ return;
- Reference< XConnection > xConnection(getConnection(xForm));
- if (!xSupTab.is())
- return;
+ Reference<XPropertySet> xFormProp(xForm,UNO_QUERY);
+ Reference< XTablesSupplier > xSupTab;
+ xFormProp->getPropertyValue("SingleSelectQueryComposer") >>= xSupTab;
- // search the field
- Reference< XColumnsSupplier > xSupCol(xSupTab,UNO_QUERY);
- Reference< css::container::XNameAccess > xFieldNames = xSupCol->getColumns();
- if (!xFieldNames->hasByName(aName))
- return;
+ Reference< XConnection > xConnection(getConnection(xForm));
+ if (!xSupTab.is())
+ return;
- Reference< css::container::XNameAccess > xTablesNames = xSupTab->getTables();
- Reference< css::beans::XPropertySet > xComposerFieldAsSet(xFieldNames->getByName(aName),UNO_QUERY);
+ // search the field
+ Reference< XColumnsSupplier > xSupCol(xSupTab,UNO_QUERY);
+ Reference< css::container::XNameAccess > xFieldNames = xSupCol->getColumns();
+ if (!xFieldNames->hasByName(aName))
+ return;
- if (xComposerFieldAsSet.is() && ::comphelper::hasProperty(FM_PROP_TABLENAME, xComposerFieldAsSet) &&
- ::comphelper::hasProperty(FM_PROP_FIELDSOURCE, xComposerFieldAsSet))
- {
- OUString aFieldName;
- OUString aTableName;
- xComposerFieldAsSet->getPropertyValue(FM_PROP_FIELDSOURCE) >>= aFieldName;
- xComposerFieldAsSet->getPropertyValue(FM_PROP_TABLENAME) >>= aTableName;
-
- // no possibility to create a select statement
- // looking for the complete table name
- if (!xTablesNames->hasByName(aTableName))
- return;
+ Reference< css::container::XNameAccess > xTablesNames = xSupTab->getTables();
+ Reference< css::beans::XPropertySet > xComposerFieldAsSet(xFieldNames->getByName(aName),UNO_QUERY);
- // build a statement and send as query;
- // Access to the connection
- Reference< XStatement > xStatement;
- Reference< XResultSet > xListCursor;
- Reference< css::sdb::XColumn > xDataField;
+ if (!xComposerFieldAsSet.is() ||
+ !::comphelper::hasProperty(FM_PROP_TABLENAME, xComposerFieldAsSet) ||
+ !::comphelper::hasProperty(FM_PROP_FIELDSOURCE, xComposerFieldAsSet))
+ return;
- try
- {
- Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData();
+ OUString aFieldName;
+ OUString aTableName;
+ xComposerFieldAsSet->getPropertyValue(FM_PROP_FIELDSOURCE) >>= aFieldName;
+ xComposerFieldAsSet->getPropertyValue(FM_PROP_TABLENAME) >>= aTableName;
- OUString aQuote(xMeta->getIdentifierQuoteString());
- OUStringBuffer aStatement("SELECT DISTINCT ");
- aStatement.append(quoteName(aQuote, aName));
- if (!aFieldName.isEmpty() && aName != aFieldName)
- {
- aStatement.append(" AS ");
- aStatement.append(quoteName(aQuote, aFieldName));
- }
+ // no possibility to create a select statement
+ // looking for the complete table name
+ if (!xTablesNames->hasByName(aTableName))
+ return;
- aStatement.append(" FROM ");
+ // build a statement and send as query;
+ // Access to the connection
+ Reference< XStatement > xStatement;
+ Reference< XResultSet > xListCursor;
+ Reference< css::sdb::XColumn > xDataField;
- Reference< XPropertySet > xTableNameAccess(xTablesNames->getByName(aTableName), UNO_QUERY_THROW);
- aStatement.append(composeTableNameForSelect(xConnection, xTableNameAccess));
+ try
+ {
+ Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData();
- xStatement = xConnection->createStatement();
- Reference< css::beans::XPropertySet > xStatementProps(xStatement, UNO_QUERY);
- xStatementProps->setPropertyValue(FM_PROP_ESCAPE_PROCESSING, makeAny(true));
+ OUString aQuote(xMeta->getIdentifierQuoteString());
+ OUStringBuffer aStatement("SELECT DISTINCT ");
+ aStatement.append(quoteName(aQuote, aName));
+ if (!aFieldName.isEmpty() && aName != aFieldName)
+ {
+ aStatement.append(" AS ");
+ aStatement.append(quoteName(aQuote, aFieldName));
+ }
- xListCursor = xStatement->executeQuery(aStatement.makeStringAndClear());
+ aStatement.append(" FROM ");
- Reference< css::sdbcx::XColumnsSupplier > xSupplyCols(xListCursor, UNO_QUERY);
- Reference< css::container::XIndexAccess > xFields(xSupplyCols->getColumns(), UNO_QUERY);
- xDataField.set(xFields->getByIndex(0), css::uno::UNO_QUERY);
- if (!xDataField.is())
- return;
- }
- catch(const Exception&)
- {
- ::comphelper::disposeComponent(xStatement);
- return;
- }
+ Reference< XPropertySet > xTableNameAccess(xTablesNames->getByName(aTableName), UNO_QUERY_THROW);
+ aStatement.append(composeTableNameForSelect(xConnection, xTableNameAccess));
- sal_Int16 i = 0;
- ::std::vector< OUString > aStringList;
- aStringList.reserve(16);
- OUString aStr;
- css::util::Date aNullDate = m_rColumn.GetParent().getNullDate();
- sal_Int32 nFormatKey = m_rColumn.GetKey();
- Reference< XNumberFormatter > xFormatter = m_rColumn.GetParent().getNumberFormatter();
- sal_Int16 nKeyType = ::comphelper::getNumberFormatType(xFormatter->getNumberFormatsSupplier()->getNumberFormats(), nFormatKey);
+ xStatement = xConnection->createStatement();
+ Reference< css::beans::XPropertySet > xStatementProps(xStatement, UNO_QUERY);
+ xStatementProps->setPropertyValue(FM_PROP_ESCAPE_PROCESSING, makeAny(true));
- while (!xListCursor->isAfterLast() && i++ < SHRT_MAX) // max number of entries
- {
- aStr = getFormattedValue(xDataField, xFormatter, aNullDate, nFormatKey, nKeyType);
- aStringList.push_back(aStr);
- (void)xListCursor->next();
- }
+ xListCursor = xStatement->executeQuery(aStatement.makeStringAndClear());
- // filling the entries for the combobox
- for (::std::vector< OUString >::const_iterator iter = aStringList.begin();
- iter != aStringList.end(); ++iter)
- static_cast<ComboBox*>(m_pWindow.get())->InsertEntry(*iter);
- }
+ Reference< css::sdbcx::XColumnsSupplier > xSupplyCols(xListCursor, UNO_QUERY);
+ Reference< css::container::XIndexAccess > xFields(xSupplyCols->getColumns(), UNO_QUERY);
+ xDataField.set(xFields->getByIndex(0), css::uno::UNO_QUERY);
+ if (!xDataField.is())
+ return;
+ }
+ catch(const Exception&)
+ {
+ ::comphelper::disposeComponent(xStatement);
+ return;
}
+
+ sal_Int16 i = 0;
+ ::std::vector< OUString > aStringList;
+ aStringList.reserve(16);
+ OUString aStr;
+ css::util::Date aNullDate = m_rColumn.GetParent().getNullDate();
+ sal_Int32 nFormatKey = m_rColumn.GetKey();
+ Reference< XNumberFormatter > xFormatter = m_rColumn.GetParent().getNumberFormatter();
+ sal_Int16 nKeyType = ::comphelper::getNumberFormatType(xFormatter->getNumberFormatsSupplier()->getNumberFormats(), nFormatKey);
+
+ while (!xListCursor->isAfterLast() && i++ < SHRT_MAX) // max number of entries
+ {
+ aStr = getFormattedValue(xDataField, xFormatter, aNullDate, nFormatKey, nKeyType);
+ aStringList.push_back(aStr);
+ (void)xListCursor->next();
+ }
+
+ // filling the entries for the combobox
+ for (::std::vector< OUString >::const_iterator iter = aStringList.begin();
+ iter != aStringList.end(); ++iter)
+ static_cast<ComboBox*>(m_pWindow.get())->InsertEntry(*iter);
}
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index e688ef251705..b99594b3ee33 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -2980,65 +2980,65 @@ void DbGridControl::Dispatch(sal_uInt16 nId)
void DbGridControl::Undo()
{
- if (!IsFilterMode() && IsValid(m_xCurrentRow) && IsModified())
- {
- // check if we have somebody doin' the UNDO for us
- int nState = -1;
- if (m_aMasterStateProvider.IsSet())
- nState = m_aMasterStateProvider.Call(DbGridControlNavigationBarState::Undo);
- if (nState>0)
- { // yes, we have, and the slot is enabled
- DBG_ASSERT(m_aMasterSlotExecutor.IsSet(), "DbGridControl::Undo : a state, but no execute link ?");
- bool lResult = m_aMasterSlotExecutor.Call(DbGridControlNavigationBarState::Undo);
- if (lResult)
- // handled
- return;
- }
- else if (nState == 0)
- // yes, we have, and the slot is disabled
+ if (IsFilterMode() || !IsValid(m_xCurrentRow) || !IsModified())
+ return;
+
+ // check if we have somebody doin' the UNDO for us
+ int nState = -1;
+ if (m_aMasterStateProvider.IsSet())
+ nState = m_aMasterStateProvider.Call(DbGridControlNavigationBarState::Undo);
+ if (nState>0)
+ { // yes, we have, and the slot is enabled
+ DBG_ASSERT(m_aMasterSlotExecutor.IsSet(), "DbGridControl::Undo : a state, but no execute link ?");
+ bool lResult = m_aMasterSlotExecutor.Call(DbGridControlNavigationBarState::Undo);
+ if (lResult)
+ // handled
return;
+ }
+ else if (nState == 0)
+ // yes, we have, and the slot is disabled
+ return;
- BeginCursorAction();
+ BeginCursorAction();
- bool bAppending = m_xCurrentRow->IsNew();
- bool bDirty = m_xCurrentRow->IsModified();
+ bool bAppending = m_xCurrentRow->IsNew();
+ bool bDirty = m_xCurrentRow->IsModified();
- try
- {
- // cancel editing
- Reference< XResultSetUpdate > xUpdateCursor(Reference< XInterface >(*m_pDataCursor), UNO_QUERY);
- // no effects if we're not updating currently
- if (bAppending)
- // just refresh the row
- xUpdateCursor->moveToInsertRow();
- else
- xUpdateCursor->cancelRowUpdates();
+ try
+ {
+ // cancel editing
+ Reference< XResultSetUpdate > xUpdateCursor(Reference< XInterface >(*m_pDataCursor), UNO_QUERY);
+ // no effects if we're not updating currently
+ if (bAppending)
+ // just refresh the row
+ xUpdateCursor->moveToInsertRow();
+ else
+ xUpdateCursor->cancelRowUpdates();
- }
- catch(Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
- EndCursorAction();
+ EndCursorAction();
- m_xDataRow->SetState(m_pDataCursor, false);
- if (m_xPaintRow == m_xCurrentRow)
- m_xPaintRow = m_xCurrentRow = m_xDataRow;
- else
- m_xCurrentRow = m_xDataRow;
+ m_xDataRow->SetState(m_pDataCursor, false);
+ if (m_xPaintRow == m_xCurrentRow)
+ m_xPaintRow = m_xCurrentRow = m_xDataRow;
+ else
+ m_xCurrentRow = m_xDataRow;
- if (bAppending && (EditBrowseBox::IsModified() || bDirty))
- // remove the row
- if (m_nCurrentPos == GetRowCount() - 2)
- { // maybe we already removed it (in resetCurrentRow, called if the above moveToInsertRow
- // caused our data source form to be reset - which should be the usual case ....)
- RowRemoved(GetRowCount() - 1);
- m_aBar->InvalidateAll(m_nCurrentPos);
- }
+ if (bAppending && (EditBrowseBox::IsModified() || bDirty))
+ // remove the row
+ if (m_nCurrentPos == GetRowCount() - 2)
+ { // maybe we already removed it (in resetCurrentRow, called if the above moveToInsertRow
+ // caused our data source form to be reset - which should be the usual case ....)
+ RowRemoved(GetRowCount() - 1);
+ m_aBar->InvalidateAll(m_nCurrentPos);
+ }
- RowModified(m_nCurrentPos);
- }
+ RowModified(m_nCurrentPos);
}
void DbGridControl::resetCurrentRow()
diff --git a/svx/source/form/fmobjfac.cxx b/svx/source/form/fmobjfac.cxx
index dd21067f6644..3244daa434a8 100644
--- a/svx/source/form/fmobjfac.cxx
+++ b/svx/source/form/fmobjfac.cxx
@@ -53,34 +53,34 @@ static bool bInit = false;
FmFormObjFactory::FmFormObjFactory()
{
- if ( !bInit )
- {
- SdrObjFactory::InsertMakeObjectHdl(LINK(this, FmFormObjFactory, MakeObject));
-
-
- // register the configuration css::frame::Controller and the NavigationBar
- SvxFmTbxCtlAbsRec::RegisterControl( SID_FM_RECORD_ABSOLUTE );
- SvxFmTbxCtlRecText::RegisterControl( SID_FM_RECORD_TEXT );
- SvxFmTbxCtlRecFromText::RegisterControl( SID_FM_RECORD_FROM_TEXT );
- SvxFmTbxCtlRecTotal::RegisterControl( SID_FM_RECORD_TOTAL );
- SvxFmTbxPrevRec::RegisterControl( SID_FM_RECORD_PREV );
- SvxFmTbxNextRec::RegisterControl( SID_FM_RECORD_NEXT );
-
- // registering global windows
- FmFieldWinMgr::RegisterChildWindow();
- FmPropBrwMgr::RegisterChildWindow();
- NavigatorFrameManager::RegisterChildWindow();
- DataNavigatorManager::RegisterChildWindow();
+ if ( bInit )
+ return;
+
+ SdrObjFactory::InsertMakeObjectHdl(LINK(this, FmFormObjFactory, MakeObject));
+
+
+ // register the configuration css::frame::Controller and the NavigationBar
+ SvxFmTbxCtlAbsRec::RegisterControl( SID_FM_RECORD_ABSOLUTE );
+ SvxFmTbxCtlRecText::RegisterControl( SID_FM_RECORD_TEXT );
+ SvxFmTbxCtlRecFromText::RegisterControl( SID_FM_RECORD_FROM_TEXT );
+ SvxFmTbxCtlRecTotal::RegisterControl( SID_FM_RECORD_TOTAL );
+ SvxFmTbxPrevRec::RegisterControl( SID_FM_RECORD_PREV );
+ SvxFmTbxNextRec::RegisterControl( SID_FM_RECORD_NEXT );
+
+ // registering global windows
+ FmFieldWinMgr::RegisterChildWindow();
+ FmPropBrwMgr::RegisterChildWindow();
+ NavigatorFrameManager::RegisterChildWindow();
+ DataNavigatorManager::RegisterChildWindow();
#if HAVE_FEATURE_DBCONNECTIVITY
- FmFilterNavigatorWinMgr::RegisterChildWindow();
+ FmFilterNavigatorWinMgr::RegisterChildWindow();
#endif
- // register the interface for the Formshell
- FmFormShell::RegisterInterface();
+ // register the interface for the Formshell
+ FmFormShell::RegisterInterface();
- ImplSmartRegisterUnoServices();
- bInit = true;
- }
+ ImplSmartRegisterUnoServices();
+ bInit = true;
}
FmFormObjFactory::~FmFormObjFactory()
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index dd9778b19063..4291215c6735 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -1838,91 +1838,91 @@ void FmXFormShell::setActiveController_Lock(const Reference<runtime::XFormContro
return;
}
- if (xController != m_xActiveController)
- {
- // switch all nav dispatchers belonging to the form of the current nav controller to 'non active'
- Reference< XResultSet> xNavigationForm;
- if (m_xNavigationController.is())
- xNavigationForm.set(m_xNavigationController->getModel(), UNO_QUERY);
+ if (xController == m_xActiveController)
+ return;
- m_bInActivate = true;
+ // switch all nav dispatchers belonging to the form of the current nav controller to 'non active'
+ Reference< XResultSet> xNavigationForm;
+ if (m_xNavigationController.is())
+ xNavigationForm.set(m_xNavigationController->getModel(), UNO_QUERY);
- // check if the 2 controllers serve different forms
- Reference< XResultSet> xOldForm;
- if (m_xActiveController.is())
- xOldForm.set(m_xActiveController->getModel(), UNO_QUERY);
- Reference< XResultSet> xNewForm;
- if (xController.is())
- xNewForm = Reference< XResultSet>(xController->getModel(), UNO_QUERY);
- xOldForm = getInternalForm_Lock(xOldForm);
- xNewForm = getInternalForm_Lock(xNewForm);
+ m_bInActivate = true;
- bool bDifferentForm = ( xOldForm.get() != xNewForm.get() );
- bool bNeedSave = bDifferentForm && !_bNoSaveOldContent;
- // we save the content of the old form if we move to a new form, and saving old content is allowed
+ // check if the 2 controllers serve different forms
+ Reference< XResultSet> xOldForm;
+ if (m_xActiveController.is())
+ xOldForm.set(m_xActiveController->getModel(), UNO_QUERY);
+ Reference< XResultSet> xNewForm;
+ if (xController.is())
+ xNewForm = Reference< XResultSet>(xController->getModel(), UNO_QUERY);
+ xOldForm = getInternalForm_Lock(xOldForm);
+ xNewForm = getInternalForm_Lock(xNewForm);
- if ( m_xActiveController.is() && bNeedSave )
+ bool bDifferentForm = ( xOldForm.get() != xNewForm.get() );
+ bool bNeedSave = bDifferentForm && !_bNoSaveOldContent;
+ // we save the content of the old form if we move to a new form, and saving old content is allowed
+
+ if ( m_xActiveController.is() && bNeedSave )
+ {
+ // save content on change of the controller; a commit has already been executed
+ if ( m_aActiveControllerFeatures->commitCurrentControl() )
{
- // save content on change of the controller; a commit has already been executed
- if ( m_aActiveControllerFeatures->commitCurrentControl() )
+ m_bSetFocus = true;
+ if ( m_aActiveControllerFeatures->isModifiedRow() )
{
- m_bSetFocus = true;
- if ( m_aActiveControllerFeatures->isModifiedRow() )
+ bool bIsNew = m_aActiveControllerFeatures->isInsertionRow();
+ bool bResult = m_aActiveControllerFeatures->commitCurrentRecord();
+ if ( !bResult && m_bSetFocus )
{
- bool bIsNew = m_aActiveControllerFeatures->isInsertionRow();
- bool bResult = m_aActiveControllerFeatures->commitCurrentRecord();
- if ( !bResult && m_bSetFocus )
- {
- // if we couldn't save the current record, set the focus back to the
- // current control
- Reference< XWindow > xWindow( m_xActiveController->getCurrentControl(), UNO_QUERY );
- if ( xWindow.is() )
- xWindow->setFocus();
- m_bInActivate = false;
- return;
- }
- else if ( bResult && bIsNew )
+ // if we couldn't save the current record, set the focus back to the
+ // current control
+ Reference< XWindow > xWindow( m_xActiveController->getCurrentControl(), UNO_QUERY );
+ if ( xWindow.is() )
+ xWindow->setFocus();
+ m_bInActivate = false;
+ return;
+ }
+ else if ( bResult && bIsNew )
+ {
+ Reference< XResultSet > xCursor( m_aActiveControllerFeatures->getCursor().get() );
+ if ( xCursor.is() )
{
- Reference< XResultSet > xCursor( m_aActiveControllerFeatures->getCursor().get() );
- if ( xCursor.is() )
- {
- DO_SAFE( xCursor->last(); );
- }
+ DO_SAFE( xCursor->last(); );
}
}
}
}
+ }
- stopListening_Lock();
+ stopListening_Lock();
- impl_switchActiveControllerListening_Lock(false);
+ impl_switchActiveControllerListening_Lock(false);
- m_aActiveControllerFeatures.dispose();
- m_xActiveController = xController;
- if ( m_xActiveController.is() )
- m_aActiveControllerFeatures.assign( m_xActiveController );
+ m_aActiveControllerFeatures.dispose();
+ m_xActiveController = xController;
+ if ( m_xActiveController.is() )
+ m_aActiveControllerFeatures.assign( m_xActiveController );
- impl_switchActiveControllerListening_Lock(true);
+ impl_switchActiveControllerListening_Lock(true);
- if ( m_xActiveController.is() )
- m_xActiveForm = getInternalForm_Lock(Reference<XForm>(m_xActiveController->getModel(), UNO_QUERY));
- else
- m_xActiveForm = nullptr;
+ if ( m_xActiveController.is() )
+ m_xActiveForm = getInternalForm_Lock(Reference<XForm>(m_xActiveController->getModel(), UNO_QUERY));
+ else
+ m_xActiveForm = nullptr;
- startListening_Lock();
+ startListening_Lock();
- // activate all dispatchers belonging to form of the new navigation controller
- xNavigationForm = nullptr;
- if (m_xNavigationController.is())
- xNavigationForm.set(m_xNavigationController->getModel(), UNO_QUERY);
+ // activate all dispatchers belonging to form of the new navigation controller
+ xNavigationForm = nullptr;
+ if (m_xNavigationController.is())
+ xNavigationForm.set(m_xNavigationController->getModel(), UNO_QUERY);
- m_bInActivate = false;
+ m_bInActivate = false;
- m_pShell->UIFeatureChanged();
- m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell);
+ m_pShell->UIFeatureChanged();
+ m_pShell->GetViewShell()->GetViewFrame()->GetBindings().InvalidateShell(*m_pShell);
- InvalidateSlot_Lock(SID_FM_FILTER_NAVIGATOR_CONTROL, true);
- }
+ InvalidateSlot_Lock(SID_FM_FILTER_NAVIGATOR_CONTROL, true);
}
diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx
index dac444874da8..b1de27d9c89e 100644
--- a/svx/source/form/tbxform.cxx
+++ b/svx/source/form/tbxform.cxx
@@ -57,27 +57,27 @@ SvxFmAbsRecWin::SvxFmAbsRecWin( vcl::Window* _pParent, SfxToolBoxControl* _pCont
void SvxFmAbsRecWin::FirePosition( bool _bForce )
{
- if ( _bForce || IsValueChangedFromSaved() )
+ if ( !_bForce && !IsValueChangedFromSaved() )
+ return;
+
+ sal_Int64 nRecord = GetValue();
+ if (nRecord < GetMin() || nRecord > GetMax())
{
- sal_Int64 nRecord = GetValue();
- if (nRecord < GetMin() || nRecord > GetMax())
- {
- return;
- }
-
- SfxInt32Item aPositionParam( FN_PARAM_1, static_cast<sal_Int32>(nRecord) );
-
- Any a;
- Sequence< PropertyValue > aArgs( 1 );
- aArgs[0].Name = "Position";
- aPositionParam.QueryValue( a );
- aArgs[0].Value = a;
- m_pController->Dispatch( ".uno:AbsoluteRecord",
- aArgs );
- m_pController->updateStatus();
-
- SaveValue();
+ return;
}
+
+ SfxInt32Item aPositionParam( FN_PARAM_1, static_cast<sal_Int32>(nRecord) );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = "Position";
+ aPositionParam.QueryValue( a );
+ aArgs[0].Value = a;
+ m_pController->Dispatch( ".uno:AbsoluteRecord",
+ aArgs );
+ m_pController->updateStatus();
+
+ SaveValue();
}
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 1cb871967e51..407da29585ff 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -566,27 +566,27 @@ IMPL_LINK_NOARG(GalleryBrowser1, ShowContextMenuHdl, void*, void)
std::vector<OString> aExecVector;
ImplGetExecuteVector(aExecVector);
- if( !aExecVector.empty() )
- {
- VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/gallerymenu1.ui", "");
- VclPtr<PopupMenu> aMenu(aBuilder.get_menu("menu"));
+ if( aExecVector.empty() )
+ return;
- aMenu->EnableItem( aMenu->GetItemId("update"), std::find( aExecVector.begin(), aExecVector.end(), "update" ) != aExecVector.end() );
- aMenu->EnableItem( aMenu->GetItemId("rename"), std::find( aExecVector.begin(), aExecVector.end(), "rename" ) != aExecVector.end() );
- aMenu->EnableItem( aMenu->GetItemId("delete"), std::find( aExecVector.begin(), aExecVector.end(), "delete" ) != aExecVector.end() );
- aMenu->EnableItem( aMenu->GetItemId("assign"), std::find( aExecVector.begin(), aExecVector.end(), "assign" ) != aExecVector.end() );
- aMenu->EnableItem( aMenu->GetItemId("properties"), std::find( aExecVector.begin(), aExecVector.end(), "properties" ) != aExecVector.end() );
- aMenu->SetSelectHdl( LINK( this, GalleryBrowser1, PopupMenuHdl ) );
- aMenu->RemoveDisabledEntries();
+ VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/gallerymenu1.ui", "");
+ VclPtr<PopupMenu> aMenu(aBuilder.get_menu("menu"));
- const tools::Rectangle aThemesRect( mpThemes->GetPosPixel(), mpThemes->GetOutputSizePixel() );
- Point aSelPos( mpThemes->GetBoundingRectangle( mpThemes->GetSelectedEntryPos() ).Center() );
+ aMenu->EnableItem( aMenu->GetItemId("update"), std::find( aExecVector.begin(), aExecVector.end(), "update" ) != aExecVector.end() );
+ aMenu->EnableItem( aMenu->GetItemId("rename"), std::find( aExecVector.begin(), aExecVector.end(), "rename" ) != aExecVector.end() );
+ aMenu->EnableItem( aMenu->GetItemId("delete"), std::find( aExecVector.begin(), aExecVector.end(), "delete" ) != aExecVector.end() );
+ aMenu->EnableItem( aMenu->GetItemId("assign"), std::find( aExecVector.begin(), aExecVector.end(), "assign" ) != aExecVector.end() );
+ aMenu->EnableItem( aMenu->GetItemId("properties"), std::find( aExecVector.begin(), aExecVector.end(), "properties" ) != aExecVector.end() );
+ aMenu->SetSelectHdl( LINK( this, GalleryBrowser1, PopupMenuHdl ) );
+ aMenu->RemoveDisabledEntries();
- aSelPos.X() = std::max( std::min( aSelPos.X(), aThemesRect.Right() ), aThemesRect.Left() );
- aSelPos.Y() = std::max( std::min( aSelPos.Y(), aThemesRect.Bottom() ), aThemesRect.Top() );
+ const tools::Rectangle aThemesRect( mpThemes->GetPosPixel(), mpThemes->GetOutputSizePixel() );
+ Point aSelPos( mpThemes->GetBoundingRectangle( mpThemes->GetSelectedEntryPos() ).Center() );
- aMenu->Execute( this, aSelPos );
- }
+ aSelPos.X() = std::max( std::min( aSelPos.X(), aThemesRect.Right() ), aThemesRect.Left() );
+ aSelPos.Y() = std::max( std::min( aSelPos.Y(), aThemesRect.Bottom() ), aThemesRect.Top() );
+
+ aMenu->Execute( this, aSelPos );
}
IMPL_LINK( GalleryBrowser1, PopupMenuHdl, Menu*, pMenu, bool )
diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx
index b711cbe21244..f23085fb65c2 100644
--- a/svx/source/gallery2/galctrl.cxx
+++ b/svx/source/gallery2/galctrl.cxx
@@ -297,62 +297,62 @@ void GalleryIconView::UserDraw(const UserDrawEvent& rUDEvt)
{
const sal_uInt16 nId = rUDEvt.GetItemId();
- if (nId && mpTheme)
- {
- const tools::Rectangle& rRect = rUDEvt.GetRect();
- const Size aSize(rRect.GetWidth(), rRect.GetHeight());
- BitmapEx aBitmapEx;
- Size aPreparedSize;
- OUString aItemTextTitle;
- OUString aItemTextPath;
+ if (!nId || !mpTheme)
+ return;
- mpTheme->GetPreviewBitmapExAndStrings(nId - 1, aBitmapEx, aPreparedSize, aItemTextTitle, aItemTextPath);
+ const tools::Rectangle& rRect = rUDEvt.GetRect();
+ const Size aSize(rRect.GetWidth(), rRect.GetHeight());
+ BitmapEx aBitmapEx;
+ Size aPreparedSize;
+ OUString aItemTextTitle;
+ OUString aItemTextPath;
- bool bNeedToCreate(aBitmapEx.IsEmpty());
-
- if (!bNeedToCreate && aItemTextTitle.isEmpty())
- {
- bNeedToCreate = true;
- }
+ mpTheme->GetPreviewBitmapExAndStrings(nId - 1, aBitmapEx, aPreparedSize, aItemTextTitle, aItemTextPath);
- if (!bNeedToCreate && aPreparedSize != aSize)
- {
- bNeedToCreate = true;
- }
+ bool bNeedToCreate(aBitmapEx.IsEmpty());
- if (bNeedToCreate)
- {
- SgaObject* pObj = mpTheme->AcquireObject(nId - 1);
+ if (!bNeedToCreate && aItemTextTitle.isEmpty())
+ {
+ bNeedToCreate = true;
+ }
- if(pObj)
- {
- aBitmapEx = pObj->createPreviewBitmapEx(aSize);
- aItemTextTitle = GalleryBrowser2::GetItemText(*mpTheme, *pObj, GalleryItemFlags::Title);
+ if (!bNeedToCreate && aPreparedSize != aSize)
+ {
+ bNeedToCreate = true;
+ }
- mpTheme->SetPreviewBitmapExAndStrings(nId - 1, aBitmapEx, aSize, aItemTextTitle, aItemTextPath);
- GalleryTheme::ReleaseObject(pObj);
- }
- }
+ if (bNeedToCreate)
+ {
+ SgaObject* pObj = mpTheme->AcquireObject(nId - 1);
- if (!aBitmapEx.IsEmpty())
+ if(pObj)
{
- const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
- const Point aPos(
- ((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
- ((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
- OutputDevice* pDev = rUDEvt.GetRenderContext();
+ aBitmapEx = pObj->createPreviewBitmapEx(aSize);
+ aItemTextTitle = GalleryBrowser2::GetItemText(*mpTheme, *pObj, GalleryItemFlags::Title);
- if(aBitmapEx.IsTransparent())
- {
- // draw checkered background for full rectangle.
- drawTransparenceBackground(*pDev, rRect.TopLeft(), rRect.GetSize());
- }
+ mpTheme->SetPreviewBitmapExAndStrings(nId - 1, aBitmapEx, aSize, aItemTextTitle, aItemTextPath);
+ GalleryTheme::ReleaseObject(pObj);
+ }
+ }
- pDev->DrawBitmapEx(aPos, aBitmapEx);
+ if (!aBitmapEx.IsEmpty())
+ {
+ const Size aBitmapExSizePixel(aBitmapEx.GetSizePixel());
+ const Point aPos(
+ ((aSize.Width() - aBitmapExSizePixel.Width()) >> 1) + rRect.Left(),
+ ((aSize.Height() - aBitmapExSizePixel.Height()) >> 1) + rRect.Top());
+ OutputDevice* pDev = rUDEvt.GetRenderContext();
+
+ if(aBitmapEx.IsTransparent())
+ {
+ // draw checkered background for full rectangle.
+ drawTransparenceBackground(*pDev, rRect.TopLeft(), rRect.GetSize());
}
- SetItemText(nId, aItemTextTitle);
+ pDev->DrawBitmapEx(aPos, aBitmapEx);
}
+
+ SetItemText(nId, aItemTextTitle);
}
void GalleryIconView::MouseButtonDown(const MouseEvent& rMEvt)
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 1e2342f2b429..0a64e17f8bc2 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -509,178 +509,178 @@ bool GalleryTheme::ChangeObjectPos( size_t nOldPos, size_t nNewPos )
void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualizeLink, GalleryProgress* pProgress )
{
- if( !IsReadOnly() )
- {
- Graphic aGraphic;
- OUString aFormat;
- GalleryObject* pEntry;
- const size_t nCount = aObjectList.size();
+ if( IsReadOnly() )
+ return;
- LockBroadcaster();
- bAbortActualize = false;
+ Graphic aGraphic;
+ OUString aFormat;
+ GalleryObject* pEntry;
+ const size_t nCount = aObjectList.size();
- // reset delete flag
- for (size_t i = 0; i < nCount; i++)
- aObjectList[ i ]->mbDelete = false;
+ LockBroadcaster();
+ bAbortActualize = false;
- for(size_t i = 0; ( i < nCount ) && !bAbortActualize; i++)
- {
- if( pProgress )
- pProgress->Update( i, nCount - 1 );
+ // reset delete flag
+ for (size_t i = 0; i < nCount; i++)
+ aObjectList[ i ]->mbDelete = false;
- pEntry = aObjectList[ i ];
+ for(size_t i = 0; ( i < nCount ) && !bAbortActualize; i++)
+ {
+ if( pProgress )
+ pProgress->Update( i, nCount - 1 );
- const INetURLObject aURL( pEntry->aURL );
+ pEntry = aObjectList[ i ];
- rActualizeLink.Call( aURL );
+ const INetURLObject aURL( pEntry->aURL );
- // SvDraw objects will be updated later
- if( pEntry->eObjKind != SgaObjKind::SvDraw )
- {
- // Still a function should be implemented,
- // which assigns files to the relevant entry.
- // insert graphics as graphic objects into the gallery
- if( pEntry->eObjKind == SgaObjKind::Sound )
- {
- SgaObjectSound aObjSound( aURL );
- if( !InsertObject( aObjSound ) )
- pEntry->mbDelete = true;
- }
- else
- {
- aGraphic.Clear();
+ rActualizeLink.Call( aURL );
- if ( GalleryGraphicImport( aURL, aGraphic, aFormat ) != GalleryGraphicImportRet::IMPORT_NONE )
- {
- std::unique_ptr<SgaObject> pNewObj;
+ // SvDraw objects will be updated later
+ if( pEntry->eObjKind != SgaObjKind::SvDraw )
+ {
+ // Still a function should be implemented,
+ // which assigns files to the relevant entry.
+ // insert graphics as graphic objects into the gallery
+ if( pEntry->eObjKind == SgaObjKind::Sound )
+ {
+ SgaObjectSound aObjSound( aURL );
+ if( !InsertObject( aObjSound ) )
+ pEntry->mbDelete = true;
+ }
+ else
+ {
+ aGraphic.Clear();
- if ( SgaObjKind::Inet == pEntry->eObjKind )
- pNewObj.reset(static_cast<SgaObject*>(new SgaObjectINet( aGraphic, aURL )));
- else if ( aGraphic.IsAnimated() )
- pNewObj.reset(static_cast<SgaObject*>(new SgaObjectAnim( aGraphic, aURL )));
- else
- pNewObj.reset(static_cast<SgaObject*>(new SgaObjectBmp( aGraphic, aURL )));
+ if ( GalleryGraphicImport( aURL, aGraphic, aFormat ) != GalleryGraphicImportRet::IMPORT_NONE )
+ {
+ std::unique_ptr<SgaObject> pNewObj;
- if( !InsertObject( *pNewObj ) )
- pEntry->mbDelete = true;
- }
+ if ( SgaObjKind::Inet == pEntry->eObjKind )
+ pNewObj.reset(static_cast<SgaObject*>(new SgaObjectINet( aGraphic, aURL )));
+ else if ( aGraphic.IsAnimated() )
+ pNewObj.reset(static_cast<SgaObject*>(new SgaObjectAnim( aGraphic, aURL )));
else
- pEntry->mbDelete = true; // set delete flag
+ pNewObj.reset(static_cast<SgaObject*>(new SgaObjectBmp( aGraphic, aURL )));
+
+ if( !InsertObject( *pNewObj ) )
+ pEntry->mbDelete = true;
}
+ else
+ pEntry->mbDelete = true; // set delete flag
}
- else
+ }
+ else
+ {
+ if ( aSvDrawStorageRef.is() )
{
- if ( aSvDrawStorageRef.is() )
- {
- const OUString aStmName( GetSvDrawStreamNameFromURL( pEntry->aURL ) );
- tools::SvRef<SotStorageStream> pIStm = aSvDrawStorageRef->OpenSotStream( aStmName, StreamMode::READ );
+ const OUString aStmName( GetSvDrawStreamNameFromURL( pEntry->aURL ) );
+ tools::SvRef<SotStorageStream> pIStm = aSvDrawStorageRef->OpenSotStream( aStmName, StreamMode::READ );
- if( pIStm.is() && !pIStm->GetError() )
- {
- pIStm->SetBufferSize( 16384 );
+ if( pIStm.is() && !pIStm->GetError() )
+ {
+ pIStm->SetBufferSize( 16384 );
- SgaObjectSvDraw aNewObj( *pIStm, pEntry->aURL );
+ SgaObjectSvDraw aNewObj( *pIStm, pEntry->aURL );
- if( !InsertObject( aNewObj ) )
- pEntry->mbDelete = true;
+ if( !InsertObject( aNewObj ) )
+ pEntry->mbDelete = true;
- pIStm->SetBufferSize( 0 );
- }
+ pIStm->SetBufferSize( 0 );
}
}
}
+ }
- // remove all entries with set flag
- for ( GalleryObjectList::iterator it = aObjectList.begin(); it != aObjectList.end(); /* increment is in the body of loop */)
+ // remove all entries with set flag
+ for ( GalleryObjectList::iterator it = aObjectList.begin(); it != aObjectList.end(); /* increment is in the body of loop */)
+ {
+ if( (*it)->mbDelete )
{
- if( (*it)->mbDelete )
- {
- Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( *it ) ) );
- Broadcast( GalleryHint( GalleryHintType::OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uLong >( *it ) ) );
- delete *it;
- it = aObjectList.erase( it );
- }
- else ++it;
+ Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT, GetName(), reinterpret_cast< sal_uIntPtr >( *it ) ) );
+ Broadcast( GalleryHint( GalleryHintType::OBJECT_REMOVED, GetName(), reinterpret_cast< sal_uLong >( *it ) ) );
+ delete *it;
+ it = aObjectList.erase( it );
}
+ else ++it;
+ }
- // update theme
- ::utl::TempFile aTmp;
- INetURLObject aInURL( GetSdgURL() );
- INetURLObject aTmpURL( aTmp.GetURL() );
+ // update theme
+ ::utl::TempFile aTmp;
+ INetURLObject aInURL( GetSdgURL() );
+ INetURLObject aTmpURL( aTmp.GetURL() );
- DBG_ASSERT( aInURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
- DBG_ASSERT( aTmpURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
+ DBG_ASSERT( aInURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
+ DBG_ASSERT( aTmpURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
- std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream( aInURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ ));
- std::unique_ptr<SvStream> pTmpStm(::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::WRITE | StreamMode::TRUNC ));
+ std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream( aInURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ ));
+ std::unique_ptr<SvStream> pTmpStm(::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::WRITE | StreamMode::TRUNC ));
- if( pIStm && pTmpStm )
+ if( pIStm && pTmpStm )
+ {
+ for (GalleryObject* i : aObjectList)
{
- for (GalleryObject* i : aObjectList)
- {
- pEntry = i;
- std::unique_ptr<SgaObject> pObj;
+ pEntry = i;
+ std::unique_ptr<SgaObject> pObj;
- switch( pEntry->eObjKind )
- {
- case SgaObjKind::Bitmap: pObj.reset(new SgaObjectBmp()); break;
- case SgaObjKind::Animation: pObj.reset(new SgaObjectAnim()); break;
- case SgaObjKind::Inet: pObj.reset(new SgaObjectINet()); break;
- case SgaObjKind::SvDraw: pObj.reset(new SgaObjectSvDraw()); break;
- case SgaObjKind::Sound: pObj.reset(new SgaObjectSound()); break;
+ switch( pEntry->eObjKind )
+ {
+ case SgaObjKind::Bitmap: pObj.reset(new SgaObjectBmp()); break;
+ case SgaObjKind::Animation: pObj.reset(new SgaObjectAnim()); break;
+ case SgaObjKind::Inet: pObj.reset(new SgaObjectINet()); break;
+ case SgaObjKind::SvDraw: pObj.reset(new SgaObjectSvDraw()); break;
+ case SgaObjKind::Sound: pObj.reset(new SgaObjectSound()); break;
- default:
- break;
- }
+ default:
+ break;
+ }
- if( pObj )
- {
- pIStm->Seek( pEntry->nOffset );
- ReadSgaObject( *pIStm, *pObj);
- pEntry->nOffset = pTmpStm->Tell();
- WriteSgaObject( *pTmpStm, *pObj );
- }
+ if( pObj )
+ {
+ pIStm->Seek( pEntry->nOffset );
+ ReadSgaObject( *pIStm, *pObj);
+ pEntry->nOffset = pTmpStm->Tell();
+ WriteSgaObject( *pTmpStm, *pObj );
}
}
- else
- {
- OSL_FAIL( "File(s) could not be opened" );
- }
-
- pIStm.reset();
- pTmpStm.reset();
+ }
+ else
+ {
+ OSL_FAIL( "File(s) could not be opened" );
+ }
- CopyFile( aTmpURL, aInURL );
- KillFile( aTmpURL );
+ pIStm.reset();
+ pTmpStm.reset();
- ErrCode nStorErr = ERRCODE_NONE;
+ CopyFile( aTmpURL, aInURL );
+ KillFile( aTmpURL );
- try
- {
- tools::SvRef<SotStorage> aTempStorageRef( new SotStorage( false, aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::STD_READWRITE ) );
- aSvDrawStorageRef->CopyTo( aTempStorageRef.get() );
- nStorErr = aSvDrawStorageRef->GetError();
- }
- catch (const css::ucb::ContentCreationException& e)
- {
- SAL_WARN("svx", "failed to open: "
- << aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE)
- << "due to : " << e);
- nStorErr = ERRCODE_IO_GENERAL;
- }
+ ErrCode nStorErr = ERRCODE_NONE;
- if( nStorErr == ERRCODE_NONE )
- {
- aSvDrawStorageRef.clear();
- CopyFile( aTmpURL, GetSdvURL() );
- ImplCreateSvDrawStorage();
- }
+ try
+ {
+ tools::SvRef<SotStorage> aTempStorageRef( new SotStorage( false, aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::STD_READWRITE ) );
+ aSvDrawStorageRef->CopyTo( aTempStorageRef.get() );
+ nStorErr = aSvDrawStorageRef->GetError();
+ }
+ catch (const css::ucb::ContentCreationException& e)
+ {
+ SAL_WARN("svx", "failed to open: "
+ << aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE)
+ << "due to : " << e);
+ nStorErr = ERRCODE_IO_GENERAL;
+ }
- KillFile( aTmpURL );
- ImplSetModified( true );
- ImplWrite();
- UnlockBroadcaster();
+ if( nStorErr == ERRCODE_NONE )
+ {
+ aSvDrawStorageRef.clear();
+ CopyFile( aTmpURL, GetSdvURL() );
+ ImplCreateSvDrawStorage();
}
+
+ KillFile( aTmpURL );
+ ImplSetModified( true );
+ ImplWrite();
+ UnlockBroadcaster();
}
GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, bool bReadOnly )
diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx
index a53d00de888a..401cd0545664 100644
--- a/svx/source/mnuctrls/smarttagmenu.cxx
+++ b/svx/source/mnuctrls/smarttagmenu.cxx
@@ -63,39 +63,39 @@ void SmartTagMenuController::statusChanged( const css::frame::FeatureStateEvent&
resetPopupMenu( m_xPopupMenu );
css::uno::Sequence< css::beans::PropertyValue > aProperties;
- if ( rEvent.IsEnabled && ( rEvent.State >>= aProperties ) )
+ if ( !rEvent.IsEnabled || !( rEvent.State >>= aProperties ) )
+ return;
+
+ css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > aActionComponents;
+ css::uno::Sequence< css::uno::Sequence< sal_Int32 > > aActionIndices;
+ css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > > aStringKeyMaps;
+ css::uno::Reference< css::text::XTextRange > xTextRange;
+ css::uno::Reference< css::frame::XController > xController;
+ css::lang::Locale aLocale;
+ OUString aApplicationName;
+ OUString aRangeText;
+
+ for ( const auto& aProperty : aProperties )
{
- css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > > aActionComponents;
- css::uno::Sequence< css::uno::Sequence< sal_Int32 > > aActionIndices;
- css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > > aStringKeyMaps;
- css::uno::Reference< css::text::XTextRange > xTextRange;
- css::uno::Reference< css::frame::XController > xController;
- css::lang::Locale aLocale;
- OUString aApplicationName;
- OUString aRangeText;
-
- for ( const auto& aProperty : aProperties )
- {
- if ( aProperty.Name == "ActionComponents" )
- aProperty.Value >>= aActionComponents;
- else if ( aProperty.Name == "ActionIndices" )
- aProperty.Value >>= aActionIndices;
- else if ( aProperty.Name == "StringKeyMaps" )
- aProperty.Value >>= aStringKeyMaps;
- else if ( aProperty.Name == "TextRange" )
- aProperty.Value >>= xTextRange;
- else if ( aProperty.Name == "Controller" )
- aProperty.Value >>= xController;
- else if ( aProperty.Name == "Locale" )
- aProperty.Value >>= aLocale;
- else if ( aProperty.Name == "ApplicationName" )
- aProperty.Value >>= aApplicationName;
- else if ( aProperty.Name == "RangeText" )
- aProperty.Value >>= aRangeText;
- }
- m_pSmartTagItem.reset( new SvxSmartTagItem( 0, aActionComponents, aActionIndices, aStringKeyMaps, xTextRange, xController, aLocale, aApplicationName, aRangeText ) );
- FillMenu();
+ if ( aProperty.Name == "ActionComponents" )
+ aProperty.Value >>= aActionComponents;
+ else if ( aProperty.Name == "ActionIndices" )
+ aProperty.Value >>= aActionIndices;
+ else if ( aProperty.Name == "StringKeyMaps" )
+ aProperty.Value >>= aStringKeyMaps;
+ else if ( aProperty.Name == "TextRange" )
+ aProperty.Value >>= xTextRange;
+ else if ( aProperty.Name == "Controller" )
+ aProperty.Value >>= xController;
+ else if ( aProperty.Name == "Locale" )
+ aProperty.Value >>= aLocale;
+ else if ( aProperty.Name == "ApplicationName" )
+ aProperty.Value >>= aApplicationName;
+ else if ( aProperty.Name == "RangeText" )
+ aProperty.Value >>= aRangeText;
}
+ m_pSmartTagItem.reset( new SvxSmartTagItem( 0, aActionComponents, aActionIndices, aStringKeyMaps, xTextRange, xController, aLocale, aApplicationName, aRangeText ) );
+ FillMenu();
}
void SmartTagMenuController::FillMenu()
diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx
index c9f367758261..367b336a3579 100644
--- a/svx/source/sdr/overlay/overlaytools.cxx
+++ b/svx/source/sdr/overlay/overlaytools.cxx
@@ -147,43 +147,43 @@ namespace drawinglayer
{
const Size aBitmapSize(getBitmapEx().GetSizePixel());
- if(aBitmapSize.Width() && aBitmapSize.Height() && basegfx::fTools::more(getDiscreteUnit(), 0.0))
+ if(!aBitmapSize.Width() || !aBitmapSize.Height() || !basegfx::fTools::more(getDiscreteUnit(), 0.0))
+ return;
+
+ // calculate back from internal bitmap's extreme coordinates (the edges)
+ // to logical coordinates. Only use a unified scaling value (getDiscreteUnit(),
+ // the prepared one which expresses how many logic units form a discrete unit)
+ // for this step. This primitive is to be displayed always unscaled (in it's pixel size)
+ // and unrotated, more like a marker
+ const double fLeft((0.0 - getCenterX()) * getDiscreteUnit());
+ const double fTop((0.0 - getCenterY()) * getDiscreteUnit());
+ const double fRight((aBitmapSize.getWidth() - getCenterX()) * getDiscreteUnit());
+ const double fBottom((aBitmapSize.getHeight() - getCenterY()) * getDiscreteUnit());
+
+ // create a BitmapPrimitive2D using those positions
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.set(0, 0, fRight - fLeft);
+ aTransform.set(1, 1, fBottom - fTop);
+ aTransform.set(0, 2, fLeft);
+ aTransform.set(1, 2, fTop);
+
+ // if shearX is used, apply it, too
+ if(!basegfx::fTools::equalZero(getShearX()))
{
- // calculate back from internal bitmap's extreme coordinates (the edges)
- // to logical coordinates. Only use a unified scaling value (getDiscreteUnit(),
- // the prepared one which expresses how many logic units form a discrete unit)
- // for this step. This primitive is to be displayed always unscaled (in it's pixel size)
- // and unrotated, more like a marker
- const double fLeft((0.0 - getCenterX()) * getDiscreteUnit());
- const double fTop((0.0 - getCenterY()) * getDiscreteUnit());
- const double fRight((aBitmapSize.getWidth() - getCenterX()) * getDiscreteUnit());
- const double fBottom((aBitmapSize.getHeight() - getCenterY()) * getDiscreteUnit());
-
- // create a BitmapPrimitive2D using those positions
- basegfx::B2DHomMatrix aTransform;
-
- aTransform.set(0, 0, fRight - fLeft);
- aTransform.set(1, 1, fBottom - fTop);
- aTransform.set(0, 2, fLeft);
- aTransform.set(1, 2, fTop);
-
- // if shearX is used, apply it, too
- if(!basegfx::fTools::equalZero(getShearX()))
- {
- aTransform.shearX(getShearX());
- }
+ aTransform.shearX(getShearX());
+ }
- // if rotation is used, apply it, too
- if(!basegfx::fTools::equalZero(getRotation()))
- {
- aTransform.rotate(getRotation());
- }
+ // if rotation is used, apply it, too
+ if(!basegfx::fTools::equalZero(getRotation()))
+ {
+ aTransform.rotate(getRotation());
+ }
- // add BasePosition
- aTransform.translate(getBasePosition().getX(), getBasePosition().getY());
+ // add BasePosition
+ aTransform.translate(getBasePosition().getX(), getBasePosition().getY());
- rContainer.push_back(new BitmapPrimitive2D(getBitmapEx(), aTransform));
- }
+ rContainer.push_back(new BitmapPrimitive2D(getBitmapEx(), aTransform));
}
bool OverlayBitmapExPrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
@@ -541,53 +541,54 @@ namespace drawinglayer
{
// use the prepared Viewport information accessible using getViewport()
- if(!getViewport().isEmpty())
- {
- basegfx::B2DPolygon aLine;
-
- // Left lines
- aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMinY()));
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
- rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
-
- aLine.clear();
- aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMaxY()));
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
- rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
-
- // Right lines
- aLine.clear();
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
- aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMinY()));
- rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
-
- aLine.clear();
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
- aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMaxY()));
- rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
-
- // Top lines
- aLine.clear();
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMinY()));
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
- rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
-
- aLine.clear();
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMinY()));
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
- rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
-
- // Bottom lines
- aLine.clear();
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMaxY()));
- rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
-
- aLine.clear();
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
- aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMaxY()));
- rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
- }
+ if(getViewport().isEmpty())
+ return;
+
+ basegfx::B2DPolygon aLine;
+
+ // Left lines
+ aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
+ rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getViewport().getMinX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
+ rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Right lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
+ aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMinY()));
+ rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getViewport().getMaxX(), getRollingRectangle().getMaxY()));
+ rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Top lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMinY()));
+ rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMinY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMinY()));
+ rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ // Bottom lines
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMinX(), getViewport().getMaxY()));
+ rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
+ aLine.clear();
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getRollingRectangle().getMaxY()));
+ aLine.append(basegfx::B2DPoint(getRollingRectangle().getMaxX(), getViewport().getMaxY()));
+ rContainer.push_back(new PolygonMarkerPrimitive2D(aLine, getRGBColorA(), getRGBColorB(), getDiscreteDashLength()));
+
}
bool OverlayRollingRectanglePrimitive::operator==( const BasePrimitive2D& rPrimitive ) const
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index de3873a8179f..b4038eab847a 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -469,45 +469,45 @@ namespace sdr
void AttributeProperties::ForceStyleToHardAttributes()
{
- if(GetStyleSheet() && dynamic_cast<const SfxStyleSheet *>(mpStyleSheet) != nullptr)
+ if(!GetStyleSheet() || dynamic_cast<const SfxStyleSheet *>(mpStyleSheet) == nullptr)
+ return;
+
+ // prepare copied, new itemset, but WITHOUT parent
+ GetObjectItemSet();
+ SfxItemSet* pDestItemSet = new SfxItemSet(*mpItemSet);
+ pDestItemSet->SetParent(nullptr);
+
+ // prepare forgetting the current stylesheet like in RemoveStyleSheet()
+ EndListening(*mpStyleSheet);
+ EndListening(mpStyleSheet->GetPool());
+
+ // prepare the iter; use the mpObjectItemSet which may have less
+ // WhichIDs than the style.
+ SfxWhichIter aIter(*pDestItemSet);
+ sal_uInt16 nWhich(aIter.FirstWhich());
+ const SfxPoolItem *pItem = nullptr;
+
+ // now set all hard attributes of the current at the new itemset
+ while(nWhich)
{
- // prepare copied, new itemset, but WITHOUT parent
- GetObjectItemSet();
- SfxItemSet* pDestItemSet = new SfxItemSet(*mpItemSet);
- pDestItemSet->SetParent(nullptr);
-
- // prepare forgetting the current stylesheet like in RemoveStyleSheet()
- EndListening(*mpStyleSheet);
- EndListening(mpStyleSheet->GetPool());
-
- // prepare the iter; use the mpObjectItemSet which may have less
- // WhichIDs than the style.
- SfxWhichIter aIter(*pDestItemSet);
- sal_uInt16 nWhich(aIter.FirstWhich());
- const SfxPoolItem *pItem = nullptr;
-
- // now set all hard attributes of the current at the new itemset
- while(nWhich)
+ // #i61284# use mpItemSet with parents, makes things easier and reduces to
+ // one loop
+ if(SfxItemState::SET == mpItemSet->GetItemState(nWhich, true, &pItem))
{
- // #i61284# use mpItemSet with parents, makes things easier and reduces to
- // one loop
- if(SfxItemState::SET == mpItemSet->GetItemState(nWhich, true, &pItem))
- {
- pDestItemSet->Put(*pItem);
- }
-
- nWhich = aIter.NextWhich();
+ pDestItemSet->Put(*pItem);
}
- // replace itemsets
- mpItemSet.reset(pDestItemSet);
+ nWhich = aIter.NextWhich();
+ }
- // set necessary changes like in RemoveStyleSheet()
- GetSdrObject().SetBoundRectDirty();
- GetSdrObject().SetRectsDirty(true);
+ // replace itemsets
+ mpItemSet.reset(pDestItemSet);
- mpStyleSheet = nullptr;
- }
+ // set necessary changes like in RemoveStyleSheet()
+ GetSdrObject().SetBoundRectDirty();
+ GetSdrObject().SetRectsDirty(true);
+
+ mpStyleSheet = nullptr;
}
void AttributeProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 64012a7af1cf..89e3584bba40 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -813,49 +813,49 @@ void PosSizePropertyPanel::NotifyItemUpdate(
void PosSizePropertyPanel::executeSize()
{
- if ( mpMtrWidth->IsValueModified() || mpMtrHeight->IsValueModified())
- {
- Fraction aUIScale = mpView->GetModel()->GetUIScale();
+ if ( !mpMtrWidth->IsValueModified() && !mpMtrHeight->IsValueModified())
+ return;
- // get Width
- double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit );
- nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
- long lWidth = (long)(nWidth * (double)aUIScale);
- lWidth = OutputDevice::LogicToLogic( lWidth, MapUnit::Map100thMM, mePoolUnit );
- lWidth = (long)mpMtrWidth->Denormalize( lWidth );
-
- // get Height
- double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit );
- nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
- long lHeight = (long)(nHeight * (double)aUIScale);
- lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit );
- lHeight = (long)mpMtrWidth->Denormalize( lHeight );
-
- // put Width & Height to itemset
- SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, (sal_uInt32) lWidth);
- SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, (sal_uInt32) lHeight);
- SfxAllEnumItem aPointItem (SID_ATTR_TRANSFORM_SIZE_POINT, (sal_uInt16)RectPoint::LT);
- const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI());
-
- if( nCombinedContext == CombinedEnumContext(Application::WriterVariants, Context::Graphic)
- || nCombinedContext == CombinedEnumContext(Application::WriterVariants, Context::OLE)
- )
- {
+ Fraction aUIScale = mpView->GetModel()->GetUIScale();
+
+ // get Width
+ double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit );
+ nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
+ long lWidth = (long)(nWidth * (double)aUIScale);
+ lWidth = OutputDevice::LogicToLogic( lWidth, MapUnit::Map100thMM, mePoolUnit );
+ lWidth = (long)mpMtrWidth->Denormalize( lWidth );
+
+ // get Height
+ double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit );
+ nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM );
+ long lHeight = (long)(nHeight * (double)aUIScale);
+ lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit );
+ lHeight = (long)mpMtrWidth->Denormalize( lHeight );
+
+ // put Width & Height to itemset
+ SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, (sal_uInt32) lWidth);
+ SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, (sal_uInt32) lHeight);
+ SfxAllEnumItem aPointItem (SID_ATTR_TRANSFORM_SIZE_POINT, (sal_uInt16)RectPoint::LT);
+ const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI());
+
+ if( nCombinedContext == CombinedEnumContext(Application::WriterVariants, Context::Graphic)
+ || nCombinedContext == CombinedEnumContext(Application::WriterVariants, Context::OLE)
+ )
+ {
+ GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
+ SfxCallMode::RECORD, { &aWidthItem, &aHeightItem, &aPointItem });
+ }
+ else
+ {
+ if ( (mpMtrWidth->IsValueModified()) && (mpMtrHeight->IsValueModified()))
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
SfxCallMode::RECORD, { &aWidthItem, &aHeightItem, &aPointItem });
- }
- else
- {
- if ( (mpMtrWidth->IsValueModified()) && (mpMtrHeight->IsValueModified()))
- GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
- SfxCallMode::RECORD, { &aWidthItem, &aHeightItem, &aPointItem });
- else if( mpMtrWidth->IsValueModified())
- GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
- SfxCallMode::RECORD, { &aWidthItem, &aPointItem });
- else if ( mpMtrHeight->IsValueModified())
- GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
- SfxCallMode::RECORD, { &aHeightItem, &aPointItem });
- }
+ else if( mpMtrWidth->IsValueModified())
+ GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
+ SfxCallMode::RECORD, { &aWidthItem, &aPointItem });
+ else if ( mpMtrHeight->IsValueModified())
+ GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
+ SfxCallMode::RECORD, { &aHeightItem, &aPointItem });
}
}
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 052db16b48ea..805b517557c6 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -2294,113 +2294,113 @@ basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation()
void SdrDragShear::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
- {
- bResize=!getSdrDragView().IsOrtho();
- long nSA=0;
+ if (!DragStat().CheckMinMoved(rPnt))
+ return;
- if (getSdrDragView().IsAngleSnapEnabled())
- nSA=getSdrDragView().GetSnapAngle();
+ bResize=!getSdrDragView().IsOrtho();
+ long nSA=0;
- Point aP0(DragStat().GetStart());
- Point aPnt(rPnt);
- Fraction aNeuFact(1,1);
+ if (getSdrDragView().IsAngleSnapEnabled())
+ nSA=getSdrDragView().GetSnapAngle();
- // if angle snapping not activated, snap to raster (except when using slant)
- if (nSA==0 && !bSlant)
- aPnt=GetSnapPos(aPnt);
+ Point aP0(DragStat().GetStart());
+ Point aPnt(rPnt);
+ Fraction aNeuFact(1,1);
- if (!bSlant && !bResize)
- { // shear, but no resize
- if (bVertical)
- aPnt.X()=aP0.X();
- else
- aPnt.Y()=aP0.Y();
- }
+ // if angle snapping not activated, snap to raster (except when using slant)
+ if (nSA==0 && !bSlant)
+ aPnt=GetSnapPos(aPnt);
- Point aRef(DragStat().GetRef1());
- Point aDif(aPnt-aRef);
+ if (!bSlant && !bResize)
+ { // shear, but no resize
+ if (bVertical)
+ aPnt.X()=aP0.X();
+ else
+ aPnt.Y()=aP0.Y();
+ }
- long nNewAngle=0;
+ Point aRef(DragStat().GetRef1());
+ Point aDif(aPnt-aRef);
- if (bSlant)
- {
- nNewAngle=NormAngle180(-(GetAngle(aDif)-nAngle0));
+ long nNewAngle=0;
- if (bVertical)
- nNewAngle=NormAngle180(-nNewAngle);
- }
+ if (bSlant)
+ {
+ nNewAngle=NormAngle180(-(GetAngle(aDif)-nAngle0));
+
+ if (bVertical)
+ nNewAngle=NormAngle180(-nNewAngle);
+ }
+ else
+ {
+ if (bVertical)
+ nNewAngle=NormAngle180(GetAngle(aDif));
else
- {
- if (bVertical)
- nNewAngle=NormAngle180(GetAngle(aDif));
- else
- nNewAngle=NormAngle180(-(GetAngle(aDif)-9000));
+ nNewAngle=NormAngle180(-(GetAngle(aDif)-9000));
- if (nNewAngle<-9000 || nNewAngle>9000)
- nNewAngle=NormAngle180(nNewAngle+18000);
+ if (nNewAngle<-9000 || nNewAngle>9000)
+ nNewAngle=NormAngle180(nNewAngle+18000);
- if (bResize)
- {
- Point aPt2(aPnt);
+ if (bResize)
+ {
+ Point aPt2(aPnt);
- if (nSA!=0)
- aPt2=GetSnapPos(aPnt); // snap this one in any case
+ if (nSA!=0)
+ aPt2=GetSnapPos(aPnt); // snap this one in any case
- if (bVertical)
- {
- aNeuFact=Fraction(aPt2.X()-aRef.X(),aP0.X()-aRef.X());
- }
- else
- {
- aNeuFact=Fraction(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y());
- }
+ if (bVertical)
+ {
+ aNeuFact=Fraction(aPt2.X()-aRef.X(),aP0.X()-aRef.X());
+ }
+ else
+ {
+ aNeuFact=Fraction(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y());
}
}
+ }
- bool bNeg=nNewAngle<0;
+ bool bNeg=nNewAngle<0;
- if (bNeg)
- nNewAngle=-nNewAngle;
+ if (bNeg)
+ nNewAngle=-nNewAngle;
- if (nSA!=0)
- { // angle snapping
- nNewAngle+=nSA/2;
- nNewAngle/=nSA;
- nNewAngle*=nSA;
- }
+ if (nSA!=0)
+ { // angle snapping
+ nNewAngle+=nSA/2;
+ nNewAngle/=nSA;
+ nNewAngle*=nSA;
+ }
- nNewAngle=NormAngle360(nNewAngle);
- bUpSideDown=nNewAngle>9000 && nNewAngle<27000;
+ nNewAngle=NormAngle360(nNewAngle);
+ bUpSideDown=nNewAngle>9000 && nNewAngle<27000;
- if (bSlant)
- { // calculate resize for slant
- // when angle snapping is activated, disable 89 degree limit
- long nTmpAngle=nNewAngle;
- if (bUpSideDown) nNewAngle-=18000;
- if (bNeg) nTmpAngle=-nTmpAngle;
- bResize=true;
- aNeuFact = cos(nTmpAngle*nPi180);
- aFact.ReduceInaccurate(10); // three decimals should be enough
- }
+ if (bSlant)
+ { // calculate resize for slant
+ // when angle snapping is activated, disable 89 degree limit
+ long nTmpAngle=nNewAngle;
+ if (bUpSideDown) nNewAngle-=18000;
+ if (bNeg) nTmpAngle=-nTmpAngle;
+ bResize=true;
+ aNeuFact = cos(nTmpAngle*nPi180);
+ aFact.ReduceInaccurate(10); // three decimals should be enough
+ }
- if (nNewAngle>8900)
- nNewAngle=8900;
+ if (nNewAngle>8900)
+ nNewAngle=8900;
- if (bNeg)
- nNewAngle=-nNewAngle;
+ if (bNeg)
+ nNewAngle=-nNewAngle;
- if (nAngle!=nNewAngle || aFact!=aNeuFact)
- {
- nAngle=nNewAngle;
- aFact=aNeuFact;
- double a=nAngle*nPi180;
- double nTan1=tan(a); // calculate now, so as little time as possible passes between Hide() and Show()
- Hide();
- nTan=nTan1;
- DragStat().NextMove(rPnt);
- Show();
- }
+ if (nAngle!=nNewAngle || aFact!=aNeuFact)
+ {
+ nAngle=nNewAngle;
+ aFact=aNeuFact;
+ double a=nAngle*nPi180;
+ double nTan1=tan(a); // calculate now, so as little time as possible passes between Hide() and Show()
+ Hide();
+ nTan=nTan1;
+ DragStat().NextMove(rPnt);
+ Show();
}
}
@@ -3097,165 +3097,165 @@ void SdrDragCrook::MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
- {
- bool bNeuMoveOnly=getSdrDragView().IsMoveOnlyDragging();
- bAtCenter=false;
- SdrCrookMode eNeuMode=getSdrDragView().GetCrookMode();
- bool bNeuContortion=!bNeuMoveOnly && ((bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed);
- bResize=!getSdrDragView().IsOrtho() && bResizeAllowed && !bNeuMoveOnly;
- bool bNeuRotate=bRotateAllowed && !bNeuContortion && !bNeuMoveOnly && eNeuMode==SdrCrookMode::Rotate;
+ if (!DragStat().CheckMinMoved(rPnt))
+ return;
- Point aPnt(GetSnapPos(rPnt));
+ bool bNeuMoveOnly=getSdrDragView().IsMoveOnlyDragging();
+ bAtCenter=false;
+ SdrCrookMode eNeuMode=getSdrDragView().GetCrookMode();
+ bool bNeuContortion=!bNeuMoveOnly && ((bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed);
+ bResize=!getSdrDragView().IsOrtho() && bResizeAllowed && !bNeuMoveOnly;
+ bool bNeuRotate=bRotateAllowed && !bNeuContortion && !bNeuMoveOnly && eNeuMode==SdrCrookMode::Rotate;
- Point aNeuCenter(aMarkCenter.X(),aStart.Y());
+ Point aPnt(GetSnapPos(rPnt));
- if (bVertical)
- {
- aNeuCenter.X()=aStart.X();
- aNeuCenter.Y()=aMarkCenter.Y();
- }
+ Point aNeuCenter(aMarkCenter.X(),aStart.Y());
- if (!getSdrDragView().IsCrookAtCenter())
+ if (bVertical)
+ {
+ aNeuCenter.X()=aStart.X();
+ aNeuCenter.Y()=aMarkCenter.Y();
+ }
+
+ if (!getSdrDragView().IsCrookAtCenter())
+ {
+ switch (GetDragHdlKind())
{
- switch (GetDragHdlKind())
- {
- case SdrHdlKind::UpperLeft: aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
- case SdrHdlKind::Upper: aNeuCenter.Y()=aMarkRect.Bottom(); bUpr=true; break;
- case SdrHdlKind::UpperRight: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
- case SdrHdlKind::Left : aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
- case SdrHdlKind::Right: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
- case SdrHdlKind::LowerLeft: aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
- case SdrHdlKind::Lower: aNeuCenter.Y()=aMarkRect.Top(); bLwr=true; break;
- case SdrHdlKind::LowerRight: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
- default: bAtCenter=true;
- }
+ case SdrHdlKind::UpperLeft: aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
+ case SdrHdlKind::Upper: aNeuCenter.Y()=aMarkRect.Bottom(); bUpr=true; break;
+ case SdrHdlKind::UpperRight: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
+ case SdrHdlKind::Left : aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
+ case SdrHdlKind::Right: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
+ case SdrHdlKind::LowerLeft: aNeuCenter.X()=aMarkRect.Right(); bLft=true; break;
+ case SdrHdlKind::Lower: aNeuCenter.Y()=aMarkRect.Top(); bLwr=true; break;
+ case SdrHdlKind::LowerRight: aNeuCenter.X()=aMarkRect.Left(); bRgt=true; break;
+ default: bAtCenter=true;
}
+ }
+ else
+ bAtCenter=true;
+
+ Fraction aNeuFact(1,1);
+ long dx1=aPnt.X()-aNeuCenter.X();
+ long dy1=aPnt.Y()-aNeuCenter.Y();
+ bValid=bVertical ? dx1!=0 : dy1!=0;
+
+ if (bValid)
+ {
+ if (bVertical)
+ bValid = std::abs(dx1)*100>std::abs(dy1);
else
- bAtCenter=true;
+ bValid = std::abs(dy1)*100>std::abs(dx1);
+ }
- Fraction aNeuFact(1,1);
- long dx1=aPnt.X()-aNeuCenter.X();
- long dy1=aPnt.Y()-aNeuCenter.Y();
- bValid=bVertical ? dx1!=0 : dy1!=0;
+ long nNeuRad=0;
+ nAngle=0;
- if (bValid)
+ if (bValid)
+ {
+ double a=0; // slope of the radius
+ long nPntWink=0;
+
+ if (bVertical)
{
- if (bVertical)
- bValid = std::abs(dx1)*100>std::abs(dy1);
- else
- bValid = std::abs(dy1)*100>std::abs(dx1);
+ a=((double)dy1)/((double)dx1); // slope of the radius
+ nNeuRad=((long)(dy1*a)+dx1) /2;
+ aNeuCenter.X()+=nNeuRad;
+ nPntWink=GetAngle(aPnt-aNeuCenter);
}
-
- long nNeuRad=0;
- nAngle=0;
-
- if (bValid)
+ else
{
- double a=0; // slope of the radius
- long nPntWink=0;
-
- if (bVertical)
- {
- a=((double)dy1)/((double)dx1); // slope of the radius
- nNeuRad=((long)(dy1*a)+dx1) /2;
- aNeuCenter.X()+=nNeuRad;
- nPntWink=GetAngle(aPnt-aNeuCenter);
- }
- else
- {
- a=((double)dx1)/((double)dy1); // slope of the radius
- nNeuRad=((long)(dx1*a)+dy1) /2;
- aNeuCenter.Y()+=nNeuRad;
- nPntWink=GetAngle(aPnt-aNeuCenter)-9000;
- }
+ a=((double)dx1)/((double)dy1); // slope of the radius
+ nNeuRad=((long)(dx1*a)+dy1) /2;
+ aNeuCenter.Y()+=nNeuRad;
+ nPntWink=GetAngle(aPnt-aNeuCenter)-9000;
+ }
- if (!bAtCenter)
+ if (!bAtCenter)
+ {
+ if (nNeuRad<0)
{
- if (nNeuRad<0)
- {
- if (bRgt) nPntWink+=18000;
- if (bLft) nPntWink=18000-nPntWink;
- if (bLwr) nPntWink=-nPntWink;
- }
- else
- {
- if (bRgt) nPntWink=-nPntWink;
- if (bUpr) nPntWink=18000-nPntWink;
- if (bLwr) nPntWink+=18000;
- }
-
- nPntWink=NormAngle360(nPntWink);
+ if (bRgt) nPntWink+=18000;
+ if (bLft) nPntWink=18000-nPntWink;
+ if (bLwr) nPntWink=-nPntWink;
}
else
{
- if (nNeuRad<0) nPntWink+=18000;
- if (bVertical) nPntWink=18000-nPntWink;
- nPntWink=NormAngle180(nPntWink);
- nPntWink = std::abs(nPntWink);
+ if (bRgt) nPntWink=-nPntWink;
+ if (bUpr) nPntWink=18000-nPntWink;
+ if (bLwr) nPntWink+=18000;
}
- double nUmfang = 2 * std::abs(nNeuRad)*nPi;
+ nPntWink=NormAngle360(nPntWink);
+ }
+ else
+ {
+ if (nNeuRad<0) nPntWink+=18000;
+ if (bVertical) nPntWink=18000-nPntWink;
+ nPntWink=NormAngle180(nPntWink);
+ nPntWink = std::abs(nPntWink);
+ }
- if (bResize)
- {
- long nMul=(long)(nUmfang*NormAngle360(nPntWink)/36000);
+ double nUmfang = 2 * std::abs(nNeuRad)*nPi;
- if (bAtCenter)
- nMul*=2;
+ if (bResize)
+ {
+ long nMul=(long)(nUmfang*NormAngle360(nPntWink)/36000);
- aNeuFact=Fraction(nMul,nMarkSize);
- nAngle=nPntWink;
- }
- else
- {
- nAngle=(long)((nMarkSize*360/nUmfang)*100)/2;
+ if (bAtCenter)
+ nMul*=2;
- if (nAngle==0)
- bValid=false;
- }
+ aNeuFact=Fraction(nMul,nMarkSize);
+ nAngle=nPntWink;
}
+ else
+ {
+ nAngle=(long)((nMarkSize*360/nUmfang)*100)/2;
- if (nAngle==0 || nNeuRad==0)
- bValid=false;
-
- if (!bValid)
- nNeuRad=0;
+ if (nAngle==0)
+ bValid=false;
+ }
+ }
- if (!bValid && bResize)
- {
- long nMul=bVertical ? dy1 : dx1;
+ if (nAngle==0 || nNeuRad==0)
+ bValid=false;
- if (bLft || bUpr)
- nMul=-nMul;
+ if (!bValid)
+ nNeuRad=0;
- long nDiv=nMarkSize;
+ if (!bValid && bResize)
+ {
+ long nMul=bVertical ? dy1 : dx1;
- if (bAtCenter)
- {
- nMul*=2;
- nMul = std::abs(nMul);
- }
+ if (bLft || bUpr)
+ nMul=-nMul;
- aNeuFact=Fraction(nMul,nDiv);
- }
+ long nDiv=nMarkSize;
- if (aNeuCenter!=aCenter || bNeuContortion!=bContortion || aNeuFact!=aFact ||
- bNeuMoveOnly != getMoveOnly() || bNeuRotate!=bRotate || eNeuMode!=eMode)
+ if (bAtCenter)
{
- Hide();
- setMoveOnly(bNeuMoveOnly);
- bRotate=bNeuRotate;
- eMode=eNeuMode;
- bContortion=bNeuContortion;
- aCenter=aNeuCenter;
- aFact=aNeuFact;
- aRad=Point(nNeuRad,nNeuRad);
- bResize=aFact!=Fraction(1,1) && aFact.GetDenominator()!=0 && aFact.IsValid();
- DragStat().NextMove(aPnt);
- Show();
+ nMul*=2;
+ nMul = std::abs(nMul);
}
+
+ aNeuFact=Fraction(nMul,nDiv);
}
+
+ if (aNeuCenter==aCenter && bNeuContortion==bContortion && aNeuFact==aFact &&
+ bNeuMoveOnly == getMoveOnly() && bNeuRotate==bRotate && eNeuMode==eMode)
+ return;
+
+ Hide();
+ setMoveOnly(bNeuMoveOnly);
+ bRotate=bNeuRotate;
+ eMode=eNeuMode;
+ bContortion=bNeuContortion;
+ aCenter=aNeuCenter;
+ aFact=aNeuFact;
+ aRad=Point(nNeuRad,nNeuRad);
+ bResize=aFact!=Fraction(1,1) && aFact.GetDenominator()!=0 && aFact.IsValid();
+ DragStat().NextMove(aPnt);
+ Show();
}
void SdrDragCrook::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index b6da423fb97b..32c1885a112e 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -951,218 +951,218 @@ std::vector<sal_uInt16> GetAllCharPropIds(const SfxItemSet& rSet)
void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll)
{
- if (AreObjectsMarked())
- {
+ if (!AreObjectsMarked())
+ return;
+
#ifdef DBG_UTIL
- {
- bool bHasEEFeatureItems=false;
- SfxItemIter aIter(rAttr);
- const SfxPoolItem* pItem=aIter.FirstItem();
- while (!bHasEEFeatureItems && pItem!=nullptr) {
- if (!IsInvalidItem(pItem)) {
- sal_uInt16 nW=pItem->Which();
- if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END) bHasEEFeatureItems=true;
- }
- pItem=aIter.NextItem();
- }
- if(bHasEEFeatureItems)
- {
- OUString aMessage("SdrEditView::SetAttrToMarked(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents.");
- ScopedVclPtrInstance<InfoBox>(nullptr, aMessage)->Execute();
+ {
+ bool bHasEEFeatureItems=false;
+ SfxItemIter aIter(rAttr);
+ const SfxPoolItem* pItem=aIter.FirstItem();
+ while (!bHasEEFeatureItems && pItem!=nullptr) {
+ if (!IsInvalidItem(pItem)) {
+ sal_uInt16 nW=pItem->Which();
+ if (nW>=EE_FEATURE_START && nW<=EE_FEATURE_END) bHasEEFeatureItems=true;
}
+ pItem=aIter.NextItem();
}
+ if(bHasEEFeatureItems)
+ {
+ OUString aMessage("SdrEditView::SetAttrToMarked(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents.");
+ ScopedVclPtrInstance<InfoBox>(nullptr, aMessage)->Execute();
+ }
+ }
#endif
- // #103836# if the user sets character attributes to the complete shape,
- // we want to remove all hard set character attributes with same
- // which ids from the text. We do that later but here we remember
- // all character attribute which id's that are set.
- std::vector<sal_uInt16> aCharWhichIds(GetAllCharPropIds(rAttr));
-
- // To make Undo reconstruct text attributes correctly after Format.Standard
- bool bHasEEItems=SearchOutlinerItems(rAttr,bReplaceAll);
-
- // save additional geometry information when paragraph or character attributes
- // are changed and the geometrical shape of the text object might be changed
- bool bPossibleGeomChange(false);
- SfxWhichIter aIter(rAttr);
- sal_uInt16 nWhich = aIter.FirstWhich();
- while(!bPossibleGeomChange && nWhich)
+ // #103836# if the user sets character attributes to the complete shape,
+ // we want to remove all hard set character attributes with same
+ // which ids from the text. We do that later but here we remember
+ // all character attribute which id's that are set.
+ std::vector<sal_uInt16> aCharWhichIds(GetAllCharPropIds(rAttr));
+
+ // To make Undo reconstruct text attributes correctly after Format.Standard
+ bool bHasEEItems=SearchOutlinerItems(rAttr,bReplaceAll);
+
+ // save additional geometry information when paragraph or character attributes
+ // are changed and the geometrical shape of the text object might be changed
+ bool bPossibleGeomChange(false);
+ SfxWhichIter aIter(rAttr);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while(!bPossibleGeomChange && nWhich)
+ {
+ SfxItemState eState = rAttr.GetItemState(nWhich);
+ if(eState == SfxItemState::SET)
{
- SfxItemState eState = rAttr.GetItemState(nWhich);
- if(eState == SfxItemState::SET)
+ if((nWhich >= SDRATTR_TEXT_MINFRAMEHEIGHT && nWhich <= SDRATTR_TEXT_CONTOURFRAME)
+ || nWhich == SDRATTR_3DOBJ_PERCENT_DIAGONAL
+ || nWhich == SDRATTR_3DOBJ_BACKSCALE
+ || nWhich == SDRATTR_3DOBJ_DEPTH
+ || nWhich == SDRATTR_3DOBJ_END_ANGLE
+ || nWhich == SDRATTR_3DSCENE_DISTANCE)
{
- if((nWhich >= SDRATTR_TEXT_MINFRAMEHEIGHT && nWhich <= SDRATTR_TEXT_CONTOURFRAME)
- || nWhich == SDRATTR_3DOBJ_PERCENT_DIAGONAL
- || nWhich == SDRATTR_3DOBJ_BACKSCALE
- || nWhich == SDRATTR_3DOBJ_DEPTH
- || nWhich == SDRATTR_3DOBJ_END_ANGLE
- || nWhich == SDRATTR_3DSCENE_DISTANCE)
- {
- bPossibleGeomChange = true;
- }
+ bPossibleGeomChange = true;
}
- nWhich = aIter.NextWhich();
}
+ nWhich = aIter.NextWhich();
+ }
- const bool bUndo = IsUndoEnabled();
- if( bUndo )
- {
- OUString aStr;
- ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
- BegUndo(aStr);
- }
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ {
+ OUString aStr;
+ ImpTakeDescriptionStr(STR_EditSetAttributes,aStr);
+ BegUndo(aStr);
+ }
- const size_t nMarkCount(GetMarkedObjectCount());
- std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
+ const size_t nMarkCount(GetMarkedObjectCount());
+ std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters;
- // create ItemSet without SfxItemState::DONTCARE. Put()
- // uses its second parameter (bInvalidAsDefault) to
- // remove all such items to set them to default.
- SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
- aAttr.Put(rAttr);
+ // create ItemSet without SfxItemState::DONTCARE. Put()
+ // uses its second parameter (bInvalidAsDefault) to
+ // remove all such items to set them to default.
+ SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
+ aAttr.Put(rAttr);
- // #i38135#
- bool bResetAnimationTimer(false);
+ // #i38135#
+ bool bResetAnimationTimer(false);
- // check if LineWidth is part of the change
- const bool bLineWidthChange(SfxItemState::SET == aAttr.GetItemState(XATTR_LINEWIDTH));
- sal_Int32 nNewLineWidth(0);
- sal_Int32 nOldLineWidth(0);
+ // check if LineWidth is part of the change
+ const bool bLineWidthChange(SfxItemState::SET == aAttr.GetItemState(XATTR_LINEWIDTH));
+ sal_Int32 nNewLineWidth(0);
+ sal_Int32 nOldLineWidth(0);
- if(bLineWidthChange)
- {
- nNewLineWidth = aAttr.Get(XATTR_LINEWIDTH).GetValue();
- }
+ if(bLineWidthChange)
+ {
+ nNewLineWidth = aAttr.Get(XATTR_LINEWIDTH).GetValue();
+ }
- for (size_t nm=0; nm<nMarkCount; ++nm)
+ for (size_t nm=0; nm<nMarkCount; ++nm)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+
+ if( bUndo )
{
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj = pM->GetMarkedSdrObj();
+ std::vector< SdrUndoAction* > vConnectorUndoActions;
+ SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >( pObj );
+ if ( pEdgeObj )
+ bPossibleGeomChange = true;
+ else if( bUndo )
+ vConnectorUndoActions = CreateConnectorUndo( *pObj );
- if( bUndo )
- {
- std::vector< SdrUndoAction* > vConnectorUndoActions;
- SdrEdgeObj* pEdgeObj = dynamic_cast< SdrEdgeObj* >( pObj );
- if ( pEdgeObj )
- bPossibleGeomChange = true;
- else if( bUndo )
- vConnectorUndoActions = CreateConnectorUndo( *pObj );
+ AddUndoActions( vConnectorUndoActions );
+ }
- AddUndoActions( vConnectorUndoActions );
- }
+ // new geometry undo
+ if(bPossibleGeomChange && bUndo)
+ {
+ // save position and size of object, too
+ AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+ }
- // new geometry undo
- if(bPossibleGeomChange && bUndo)
- {
- // save position and size of object, too
- AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
- }
+ if( bUndo )
+ {
+ // #i8508#
+ // If this is a text object also rescue the OutlinerParaObject since
+ // applying attributes to the object may change text layout when
+ // multiple portions exist with multiple formats. If a OutlinerParaObject
+ // really exists and needs to be rescued is evaluated in the undo
+ // implementation itself.
+ const bool bRescueText = dynamic_cast< SdrTextObj* >(pObj) != nullptr;
+
+ // add attribute undo
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,false,bHasEEItems || bPossibleGeomChange || bRescueText));
+ }
- if( bUndo )
- {
- // #i8508#
- // If this is a text object also rescue the OutlinerParaObject since
- // applying attributes to the object may change text layout when
- // multiple portions exist with multiple formats. If a OutlinerParaObject
- // really exists and needs to be rescued is evaluated in the undo
- // implementation itself.
- const bool bRescueText = dynamic_cast< SdrTextObj* >(pObj) != nullptr;
-
- // add attribute undo
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,false,bHasEEItems || bPossibleGeomChange || bRescueText));
- }
+ // set up a scene updater if object is a 3d object
+ if(dynamic_cast< E3dObject* >(pObj))
+ {
+ aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
+ }
- // set up a scene updater if object is a 3d object
- if(dynamic_cast< E3dObject* >(pObj))
- {
- aUpdaters.push_back(new E3DModifySceneSnapRectUpdater(pObj));
- }
+ if(bLineWidthChange)
+ {
+ nOldLineWidth = pObj->GetMergedItem(XATTR_LINEWIDTH).GetValue();
+ }
- if(bLineWidthChange)
- {
- nOldLineWidth = pObj->GetMergedItem(XATTR_LINEWIDTH).GetValue();
- }
+ // set attributes at object
+ pObj->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
- // set attributes at object
- pObj->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
+ if(bLineWidthChange)
+ {
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
- if(bLineWidthChange)
+ if(nOldLineWidth != nNewLineWidth)
{
- const SfxItemSet& rSet = pObj->GetMergedItemSet();
-
- if(nOldLineWidth != nNewLineWidth)
+ if(SfxItemState::DONTCARE != rSet.GetItemState(XATTR_LINESTARTWIDTH))
{
- if(SfxItemState::DONTCARE != rSet.GetItemState(XATTR_LINESTARTWIDTH))
- {
- const sal_Int32 nValAct(rSet.Get(XATTR_LINESTARTWIDTH).GetValue());
- const sal_Int32 nValNewStart(std::max((sal_Int32)0, nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10)));
+ const sal_Int32 nValAct(rSet.Get(XATTR_LINESTARTWIDTH).GetValue());
+ const sal_Int32 nValNewStart(std::max((sal_Int32)0, nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10)));
- pObj->SetMergedItem(XLineStartWidthItem(nValNewStart));
- }
+ pObj->SetMergedItem(XLineStartWidthItem(nValNewStart));
+ }
- if(SfxItemState::DONTCARE != rSet.GetItemState(XATTR_LINEENDWIDTH))
- {
- const sal_Int32 nValAct(rSet.Get(XATTR_LINEENDWIDTH).GetValue());
- const sal_Int32 nValNewEnd(std::max((sal_Int32)0, nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10)));
+ if(SfxItemState::DONTCARE != rSet.GetItemState(XATTR_LINEENDWIDTH))
+ {
+ const sal_Int32 nValAct(rSet.Get(XATTR_LINEENDWIDTH).GetValue());
+ const sal_Int32 nValNewEnd(std::max((sal_Int32)0, nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10)));
- pObj->SetMergedItem(XLineEndWidthItem(nValNewEnd));
- }
+ pObj->SetMergedItem(XLineEndWidthItem(nValNewEnd));
}
}
+ }
- if(dynamic_cast<const SdrTextObj*>( pObj) != nullptr)
- {
- SdrTextObj* pTextObj = static_cast<SdrTextObj*>(pObj);
+ if(dynamic_cast<const SdrTextObj*>( pObj) != nullptr)
+ {
+ SdrTextObj* pTextObj = static_cast<SdrTextObj*>(pObj);
- if(!aCharWhichIds.empty())
- {
- tools::Rectangle aOldBoundRect = pTextObj->GetLastBoundRect();
+ if(!aCharWhichIds.empty())
+ {
+ tools::Rectangle aOldBoundRect = pTextObj->GetLastBoundRect();
- // #110094#-14 pTextObj->SendRepaintBroadcast(pTextObj->GetBoundRect());
- pTextObj->RemoveOutlinerCharacterAttribs( aCharWhichIds );
+ // #110094#-14 pTextObj->SendRepaintBroadcast(pTextObj->GetBoundRect());
+ pTextObj->RemoveOutlinerCharacterAttribs( aCharWhichIds );
- // object has changed, should be called from
- // RemoveOutlinerCharacterAttribs. This will change when the text
- // object implementation changes.
- pTextObj->SetChanged();
+ // object has changed, should be called from
+ // RemoveOutlinerCharacterAttribs. This will change when the text
+ // object implementation changes.
+ pTextObj->SetChanged();
- pTextObj->BroadcastObjectChange();
- pTextObj->SendUserCall(SdrUserCallType::ChangeAttr, aOldBoundRect);
- }
+ pTextObj->BroadcastObjectChange();
+ pTextObj->SendUserCall(SdrUserCallType::ChangeAttr, aOldBoundRect);
}
+ }
- // #i38495#
- if(!bResetAnimationTimer)
+ // #i38495#
+ if(!bResetAnimationTimer)
+ {
+ if(pObj->GetViewContact().isAnimatedInAnyViewObjectContact())
{
- if(pObj->GetViewContact().isAnimatedInAnyViewObjectContact())
- {
- bResetAnimationTimer = true;
- }
+ bResetAnimationTimer = true;
}
}
+ }
- // fire scene updaters
- while(!aUpdaters.empty())
- {
- delete aUpdaters.back();
- aUpdaters.pop_back();
- }
+ // fire scene updaters
+ while(!aUpdaters.empty())
+ {
+ delete aUpdaters.back();
+ aUpdaters.pop_back();
+ }
- // #i38135#
- if(bResetAnimationTimer)
- {
- SetAnimationTimer(0);
- }
+ // #i38135#
+ if(bResetAnimationTimer)
+ {
+ SetAnimationTimer(0);
+ }
- // better check before what to do:
- // pObj->SetAttr() or SetNotPersistAttr()
- // TODO: missing implementation!
- SetNotPersistAttrToMarked(rAttr);
+ // better check before what to do:
+ // pObj->SetAttr() or SetNotPersistAttr()
+ // TODO: missing implementation!
+ SetNotPersistAttrToMarked(rAttr);
- if( bUndo )
- EndUndo();
- }
+ if( bUndo )
+ EndUndo();
}
SfxStyleSheet* SdrEditView::GetStyleSheetFromMarked() const
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 9af01a3954f8..adbe04295a1c 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -245,97 +245,97 @@ void SdrEditView::PutMarkedToTop()
void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj)
{
const size_t nCount=GetMarkedObjectCount();
- if (nCount!=0)
- {
- const bool bUndo = IsUndoEnabled();
- if( bUndo )
- BegUndo(ImpGetResStr(STR_EditPutToTop),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::PutToTop);
+ if (nCount==0)
+ return;
- SortMarkedObjects();
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditPutToTop),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::PutToTop);
+
+ SortMarkedObjects();
- if (pRefObj!=nullptr)
+ if (pRefObj!=nullptr)
+ {
+ // Make "in front of the object" work, even if the
+ // selected objects are already in front of the other object
+ const size_t nRefMark=TryToFindMarkedObject(pRefObj);
+ SdrMark aRefMark;
+ if (nRefMark!=SAL_MAX_SIZE)
{
- // Make "in front of the object" work, even if the
- // selected objects are already in front of the other object
- const size_t nRefMark=TryToFindMarkedObject(pRefObj);
- SdrMark aRefMark;
- if (nRefMark!=SAL_MAX_SIZE)
+ aRefMark=*GetSdrMarkByIndex(nRefMark);
+ GetMarkedObjectListWriteAccess().DeleteMark(nRefMark);
+ }
+ PutMarkedToBtm();
+ if (nRefMark!=SAL_MAX_SIZE)
+ {
+ GetMarkedObjectListWriteAccess().InsertEntry(aRefMark);
+ SortMarkedObjects();
+ }
+ }
+ for (size_t nm=0; nm<nCount; ++nm)
+ { // All Ordnums have to be correct!
+ GetMarkedObjectByIndex(nm)->GetOrdNum();
+ }
+ bool bChg=false;
+ SdrObjList* pOL0=nullptr;
+ size_t nNewPos=0;
+ for (size_t nm=nCount; nm>0;)
+ {
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (pObj!=pRefObj)
+ {
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0)
{
- aRefMark=*GetSdrMarkByIndex(nRefMark);
- GetMarkedObjectListWriteAccess().DeleteMark(nRefMark);
+ nNewPos=pOL->GetObjCount()-1;
+ pOL0=pOL;
}
- PutMarkedToBtm();
- if (nRefMark!=SAL_MAX_SIZE)
+ const size_t nNowPos=pObj->GetOrdNumDirect();
+ SdrObject* pMaxObj=GetMaxToTopObj(pObj);
+ if (pMaxObj!=nullptr)
{
- GetMarkedObjectListWriteAccess().InsertEntry(aRefMark);
- SortMarkedObjects();
+ size_t nMaxOrd=pMaxObj->GetOrdNum(); // sadly doesn't work any other way
+ if (nMaxOrd>0)
+ nMaxOrd--;
+ if (nNewPos>nMaxOrd)
+ nNewPos=nMaxOrd; // neither go faster...
+ if (nNewPos<nNowPos)
+ nNewPos=nNowPos; // nor go into the other direction
}
- }
- for (size_t nm=0; nm<nCount; ++nm)
- { // All Ordnums have to be correct!
- GetMarkedObjectByIndex(nm)->GetOrdNum();
- }
- bool bChg=false;
- SdrObjList* pOL0=nullptr;
- size_t nNewPos=0;
- for (size_t nm=nCount; nm>0;)
- {
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- if (pObj!=pRefObj)
+ if (pRefObj!=nullptr)
{
- SdrObjList* pOL=pObj->GetObjList();
- if (pOL!=pOL0)
+ if (pRefObj->GetObjList()==pObj->GetObjList())
{
- nNewPos=pOL->GetObjCount()-1;
- pOL0=pOL;
- }
- const size_t nNowPos=pObj->GetOrdNumDirect();
- SdrObject* pMaxObj=GetMaxToTopObj(pObj);
- if (pMaxObj!=nullptr)
- {
- size_t nMaxOrd=pMaxObj->GetOrdNum(); // sadly doesn't work any other way
- if (nMaxOrd>0)
- nMaxOrd--;
+ const size_t nMaxOrd=pRefObj->GetOrdNum(); // sadly doesn't work any other way
if (nNewPos>nMaxOrd)
nNewPos=nMaxOrd; // neither go faster...
if (nNewPos<nNowPos)
nNewPos=nNowPos; // nor go into the other direction
}
- if (pRefObj!=nullptr)
- {
- if (pRefObj->GetObjList()==pObj->GetObjList())
- {
- const size_t nMaxOrd=pRefObj->GetOrdNum(); // sadly doesn't work any other way
- if (nNewPos>nMaxOrd)
- nNewPos=nMaxOrd; // neither go faster...
- if (nNewPos<nNowPos)
- nNewPos=nNowPos; // nor go into the other direction
- }
- else
- {
- nNewPos=nNowPos; // different PageView, so don't change
- }
- }
- if (nNowPos!=nNewPos)
+ else
{
- bChg=true;
- pOL->SetObjectOrdNum(nNowPos,nNewPos);
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
- ObjOrderChanged(pObj,nNowPos,nNewPos);
+ nNewPos=nNowPos; // different PageView, so don't change
}
- nNewPos--;
- } // if (pObj!=pRefObj)
- } // for loop over all selected objects
+ }
+ if (nNowPos!=nNewPos)
+ {
+ bChg=true;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos--;
+ } // if (pObj!=pRefObj)
+ } // for loop over all selected objects
- if( bUndo )
- EndUndo();
+ if( bUndo )
+ EndUndo();
- if(bChg)
- MarkListHasChanged();
- }
+ if(bChg)
+ MarkListHasChanged();
}
void SdrEditView::PutMarkedToBtm()
@@ -346,80 +346,81 @@ void SdrEditView::PutMarkedToBtm()
void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj)
{
const size_t nCount=GetMarkedObjectCount();
- if (nCount!=0)
- {
- const bool bUndo = IsUndoEnabled();
+ if (nCount==0)
+ return;
- if( bUndo )
- BegUndo(ImpGetResStr(STR_EditPutToBtm),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::PutToBottom);
+ const bool bUndo = IsUndoEnabled();
- SortMarkedObjects();
- if (pRefObj!=nullptr)
+ if( bUndo )
+ BegUndo(ImpGetResStr(STR_EditPutToBtm),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::PutToBottom);
+
+ SortMarkedObjects();
+ if (pRefObj!=nullptr)
+ {
+ // Make "behind the object" work, even if the
+ // selected objects are already behind the other object
+ const size_t nRefMark=TryToFindMarkedObject(pRefObj);
+ SdrMark aRefMark;
+ if (nRefMark!=SAL_MAX_SIZE)
{
- // Make "behind the object" work, even if the
- // selected objects are already behind the other object
- const size_t nRefMark=TryToFindMarkedObject(pRefObj);
- SdrMark aRefMark;
- if (nRefMark!=SAL_MAX_SIZE)
- {
- aRefMark=*GetSdrMarkByIndex(nRefMark);
- GetMarkedObjectListWriteAccess().DeleteMark(nRefMark);
- }
- PutMarkedToTop();
- if (nRefMark!=SAL_MAX_SIZE)
- {
- GetMarkedObjectListWriteAccess().InsertEntry(aRefMark);
- SortMarkedObjects();
- }
+ aRefMark=*GetSdrMarkByIndex(nRefMark);
+ GetMarkedObjectListWriteAccess().DeleteMark(nRefMark);
}
- for (size_t nm=0; nm<nCount; ++nm) { // All Ordnums have to be correct!
- GetMarkedObjectByIndex(nm)->GetOrdNum();
+ PutMarkedToTop();
+ if (nRefMark!=SAL_MAX_SIZE)
+ {
+ GetMarkedObjectListWriteAccess().InsertEntry(aRefMark);
+ SortMarkedObjects();
}
- bool bChg=false;
- SdrObjList* pOL0=nullptr;
- size_t nNewPos=0;
- for (size_t nm=0; nm<nCount; ++nm) {
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- if (pObj!=pRefObj) {
- SdrObjList* pOL=pObj->GetObjList();
- if (pOL!=pOL0) {
- nNewPos=0;
- pOL0=pOL;
- }
- const size_t nNowPos=pObj->GetOrdNumDirect();
- SdrObject* pMinObj=GetMaxToBtmObj(pObj);
- if (pMinObj!=nullptr) {
- const size_t nMinOrd=pMinObj->GetOrdNum()+1; // sadly doesn't work any differently
+ }
+ for (size_t nm=0; nm<nCount; ++nm) { // All Ordnums have to be correct!
+ GetMarkedObjectByIndex(nm)->GetOrdNum();
+ }
+ bool bChg=false;
+ SdrObjList* pOL0=nullptr;
+ size_t nNewPos=0;
+ for (size_t nm=0; nm<nCount; ++nm) {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (pObj!=pRefObj) {
+ SdrObjList* pOL=pObj->GetObjList();
+ if (pOL!=pOL0) {
+ nNewPos=0;
+ pOL0=pOL;
+ }
+ const size_t nNowPos=pObj->GetOrdNumDirect();
+ SdrObject* pMinObj=GetMaxToBtmObj(pObj);
+ if (pMinObj!=nullptr) {
+ const size_t nMinOrd=pMinObj->GetOrdNum()+1; // sadly doesn't work any differently
+ if (nNewPos<nMinOrd) nNewPos=nMinOrd; // neither go faster...
+ if (nNewPos>nNowPos) nNewPos=nNowPos; // nor go into the other direction
+ }
+ if (pRefObj!=nullptr) {
+ if (pRefObj->GetObjList()==pObj->GetObjList()) {
+ const size_t nMinOrd=pRefObj->GetOrdNum(); // sadly doesn't work any differently
if (nNewPos<nMinOrd) nNewPos=nMinOrd; // neither go faster...
if (nNewPos>nNowPos) nNewPos=nNowPos; // nor go into the other direction
+ } else {
+ nNewPos=nNowPos; // different PageView, so don't change
}
- if (pRefObj!=nullptr) {
- if (pRefObj->GetObjList()==pObj->GetObjList()) {
- const size_t nMinOrd=pRefObj->GetOrdNum(); // sadly doesn't work any differently
- if (nNewPos<nMinOrd) nNewPos=nMinOrd; // neither go faster...
- if (nNewPos>nNowPos) nNewPos=nNowPos; // nor go into the other direction
- } else {
- nNewPos=nNowPos; // different PageView, so don't change
- }
- }
- if (nNowPos!=nNewPos) {
- bChg=true;
- pOL->SetObjectOrdNum(nNowPos,nNewPos);
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
- ObjOrderChanged(pObj,nNowPos,nNewPos);
- }
- nNewPos++;
- } // if (pObj!=pRefObj)
- } // for loop over all selected objects
+ }
+ if (nNowPos!=nNewPos) {
+ bChg=true;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos++;
+ } // if (pObj!=pRefObj)
+ } // for loop over all selected objects
- if(bUndo)
- EndUndo();
+ if(bUndo)
+ EndUndo();
+
+ if(bChg)
+ MarkListHasChanged();
- if(bChg)
- MarkListHasChanged();
- }
}
void SdrEditView::ReverseOrderOfMarked()
@@ -989,186 +990,186 @@ void SdrEditView::DistributeMarkedObjects()
void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode)
{
// #i73441# check content
- if(AreObjectsMarked())
- {
- SdrMarkList aRemove;
- SortMarkedObjects();
+ if(!AreObjectsMarked())
+ return;
- const bool bUndo = IsUndoEnabled();
+ SdrMarkList aRemove;
+ SortMarkedObjects();
- if( bUndo )
- BegUndo();
-
- size_t nInsPos = SAL_MAX_SIZE;
- const SdrObject* pAttrObj = nullptr;
- basegfx::B2DPolyPolygon aMergePolyPolygonA;
- basegfx::B2DPolyPolygon aMergePolyPolygonB;
-
- SdrObjList* pInsOL = nullptr;
- SdrPageView* pInsPV = nullptr;
- bool bFirstObjectComplete(false);
-
- // make sure selected objects are contour objects
- // since now basegfx::utils::adaptiveSubdivide() is used, it is no longer
- // necessary to use ConvertMarkedToPolyObj which will subdivide curves using the old
- // mechanisms. In a next step the polygon clipper will even be able to clip curves...
- // ConvertMarkedToPolyObj(true);
- ConvertMarkedToPathObj(true);
- OSL_ENSURE(AreObjectsMarked(), "no more objects selected after preparations (!)");
-
- for(size_t a=0; a<GetMarkedObjectCount(); ++a)
- {
- SdrMark* pM = GetSdrMarkByIndex(a);
- SdrObject* pObj = pM->GetMarkedSdrObj();
+ const bool bUndo = IsUndoEnabled();
- if(ImpCanConvertForCombine(pObj))
- {
- if(!pAttrObj)
- pAttrObj = pObj;
+ if( bUndo )
+ BegUndo();
- nInsPos = pObj->GetOrdNum() + 1;
- pInsPV = pM->GetPageView();
- pInsOL = pObj->GetObjList();
+ size_t nInsPos = SAL_MAX_SIZE;
+ const SdrObject* pAttrObj = nullptr;
+ basegfx::B2DPolyPolygon aMergePolyPolygonA;
+ basegfx::B2DPolyPolygon aMergePolyPolygonB;
- // #i76891# use single iteration from SJ here which works on SdrObjects and takes
- // groups into account by itself
- SdrObjListIter aIter(*pObj, SdrIterMode::DeepWithGroups);
+ SdrObjList* pInsOL = nullptr;
+ SdrPageView* pInsPV = nullptr;
+ bool bFirstObjectComplete(false);
- while(aIter.IsMore())
+ // make sure selected objects are contour objects
+ // since now basegfx::utils::adaptiveSubdivide() is used, it is no longer
+ // necessary to use ConvertMarkedToPolyObj which will subdivide curves using the old
+ // mechanisms. In a next step the polygon clipper will even be able to clip curves...
+ // ConvertMarkedToPolyObj(true);
+ ConvertMarkedToPathObj(true);
+ OSL_ENSURE(AreObjectsMarked(), "no more objects selected after preparations (!)");
+
+ for(size_t a=0; a<GetMarkedObjectCount(); ++a)
+ {
+ SdrMark* pM = GetSdrMarkByIndex(a);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+
+ if(ImpCanConvertForCombine(pObj))
+ {
+ if(!pAttrObj)
+ pAttrObj = pObj;
+
+ nInsPos = pObj->GetOrdNum() + 1;
+ pInsPV = pM->GetPageView();
+ pInsOL = pObj->GetObjList();
+
+ // #i76891# use single iteration from SJ here which works on SdrObjects and takes
+ // groups into account by itself
+ SdrObjListIter aIter(*pObj, SdrIterMode::DeepWithGroups);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pCandidate = aIter.Next();
+ SdrPathObj* pPathObj = dynamic_cast<SdrPathObj*>( pCandidate );
+ if(pPathObj)
{
- SdrObject* pCandidate = aIter.Next();
- SdrPathObj* pPathObj = dynamic_cast<SdrPathObj*>( pCandidate );
- if(pPathObj)
- {
- basegfx::B2DPolyPolygon aTmpPoly(pPathObj->GetPathPoly());
+ basegfx::B2DPolyPolygon aTmpPoly(pPathObj->GetPathPoly());
- // #i76891# unfortunately ConvertMarkedToPathObj has converted all
- // involved polygon data to curve segments, even if not necessary.
- // It is better to try to reduce to more simple polygons.
- aTmpPoly = basegfx::utils::simplifyCurveSegments(aTmpPoly);
+ // #i76891# unfortunately ConvertMarkedToPathObj has converted all
+ // involved polygon data to curve segments, even if not necessary.
+ // It is better to try to reduce to more simple polygons.
+ aTmpPoly = basegfx::utils::simplifyCurveSegments(aTmpPoly);
- // for each part polygon as preparation, remove self-intersections
- // correct orientations and get rid of possible neutral polygons.
- aTmpPoly = basegfx::utils::prepareForPolygonOperation(aTmpPoly);
+ // for each part polygon as preparation, remove self-intersections
+ // correct orientations and get rid of possible neutral polygons.
+ aTmpPoly = basegfx::utils::prepareForPolygonOperation(aTmpPoly);
- if(!bFirstObjectComplete)
+ if(!bFirstObjectComplete)
+ {
+ // #i111987# Also need to collect ORed source shape when more than
+ // a single polygon is involved
+ if(aMergePolyPolygonA.count())
{
- // #i111987# Also need to collect ORed source shape when more than
- // a single polygon is involved
- if(aMergePolyPolygonA.count())
- {
- aMergePolyPolygonA = basegfx::utils::solvePolygonOperationOr(aMergePolyPolygonA, aTmpPoly);
- }
- else
- {
- aMergePolyPolygonA = aTmpPoly;
- }
+ aMergePolyPolygonA = basegfx::utils::solvePolygonOperationOr(aMergePolyPolygonA, aTmpPoly);
}
else
{
- if(aMergePolyPolygonB.count())
- {
- // to topologically correctly collect the 2nd polygon
- // group it is necessary to OR the parts (each is seen as
- // XOR-FillRule polygon and they are drawn over each-other)
- aMergePolyPolygonB = basegfx::utils::solvePolygonOperationOr(aMergePolyPolygonB, aTmpPoly);
- }
- else
- {
- aMergePolyPolygonB = aTmpPoly;
- }
+ aMergePolyPolygonA = aTmpPoly;
+ }
+ }
+ else
+ {
+ if(aMergePolyPolygonB.count())
+ {
+ // to topologically correctly collect the 2nd polygon
+ // group it is necessary to OR the parts (each is seen as
+ // XOR-FillRule polygon and they are drawn over each-other)
+ aMergePolyPolygonB = basegfx::utils::solvePolygonOperationOr(aMergePolyPolygonB, aTmpPoly);
+ }
+ else
+ {
+ aMergePolyPolygonB = aTmpPoly;
}
}
}
+ }
- // was there something added to the first polygon?
- if(!bFirstObjectComplete && aMergePolyPolygonA.count())
- {
- bFirstObjectComplete = true;
- }
-
- // move object to temporary delete list
- aRemove.InsertEntry(SdrMark(pObj, pM->GetPageView()));
+ // was there something added to the first polygon?
+ if(!bFirstObjectComplete && aMergePolyPolygonA.count())
+ {
+ bFirstObjectComplete = true;
}
+
+ // move object to temporary delete list
+ aRemove.InsertEntry(SdrMark(pObj, pM->GetPageView()));
}
+ }
- switch(eMode)
+ switch(eMode)
+ {
+ case SdrMergeMode::Merge:
{
- case SdrMergeMode::Merge:
+ // merge all contained parts (OR)
+ static bool bTestXOR(false);
+ if(bTestXOR)
{
- // merge all contained parts (OR)
- static bool bTestXOR(false);
- if(bTestXOR)
- {
- aMergePolyPolygonA = basegfx::utils::solvePolygonOperationXor(aMergePolyPolygonA, aMergePolyPolygonB);
- }
- else
- {
- aMergePolyPolygonA = basegfx::utils::solvePolygonOperationOr(aMergePolyPolygonA, aMergePolyPolygonB);
- }
- break;
+ aMergePolyPolygonA = basegfx::utils::solvePolygonOperationXor(aMergePolyPolygonA, aMergePolyPolygonB);
}
- case SdrMergeMode::Subtract:
- {
- // Subtract B from A
- aMergePolyPolygonA = basegfx::utils::solvePolygonOperationDiff(aMergePolyPolygonA, aMergePolyPolygonB);
- break;
- }
- case SdrMergeMode::Intersect:
+ else
{
- // AND B and A
- aMergePolyPolygonA = basegfx::utils::solvePolygonOperationAnd(aMergePolyPolygonA, aMergePolyPolygonB);
- break;
+ aMergePolyPolygonA = basegfx::utils::solvePolygonOperationOr(aMergePolyPolygonA, aMergePolyPolygonB);
}
+ break;
}
-
- // #i73441# check insert list before taking actions
- if(pInsOL)
+ case SdrMergeMode::Subtract:
{
- SdrPathObj* pPath = new SdrPathObj(OBJ_PATHFILL, aMergePolyPolygonA);
- ImpCopyAttributes(pAttrObj, pPath);
- pInsOL->InsertObject(pPath, nInsPos);
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath));
-
- // #i124760# To have a correct selection with only the new object it is necessary to
- // unmark all objects first. If not doing so, there may remain invalid pointers to objects
- //TTTT:Not needed for aw080 (!)
- UnmarkAllObj(pInsPV);
-
- MarkObj(pPath, pInsPV, false, true);
+ // Subtract B from A
+ aMergePolyPolygonA = basegfx::utils::solvePolygonOperationDiff(aMergePolyPolygonA, aMergePolyPolygonB);
+ break;
}
-
- aRemove.ForceSort();
- switch(eMode)
+ case SdrMergeMode::Intersect:
{
- case SdrMergeMode::Merge:
- {
- SetUndoComment(
- ImpGetResStr(STR_EditMergeMergePoly),
- aRemove.GetMarkDescription());
- break;
- }
- case SdrMergeMode::Subtract:
- {
- SetUndoComment(
- ImpGetResStr(STR_EditMergeSubstractPoly),
- aRemove.GetMarkDescription());
- break;
- }
- case SdrMergeMode::Intersect:
- {
- SetUndoComment(
- ImpGetResStr(STR_EditMergeIntersectPoly),
- aRemove.GetMarkDescription());
- break;
- }
+ // AND B and A
+ aMergePolyPolygonA = basegfx::utils::solvePolygonOperationAnd(aMergePolyPolygonA, aMergePolyPolygonB);
+ break;
}
- DeleteMarkedList(aRemove);
+ }
+ // #i73441# check insert list before taking actions
+ if(pInsOL)
+ {
+ SdrPathObj* pPath = new SdrPathObj(OBJ_PATHFILL, aMergePolyPolygonA);
+ ImpCopyAttributes(pAttrObj, pPath);
+ pInsOL->InsertObject(pPath, nInsPos);
if( bUndo )
- EndUndo();
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath));
+
+ // #i124760# To have a correct selection with only the new object it is necessary to
+ // unmark all objects first. If not doing so, there may remain invalid pointers to objects
+ //TTTT:Not needed for aw080 (!)
+ UnmarkAllObj(pInsPV);
+
+ MarkObj(pPath, pInsPV, false, true);
+ }
+
+ aRemove.ForceSort();
+ switch(eMode)
+ {
+ case SdrMergeMode::Merge:
+ {
+ SetUndoComment(
+ ImpGetResStr(STR_EditMergeMergePoly),
+ aRemove.GetMarkDescription());
+ break;
+ }
+ case SdrMergeMode::Subtract:
+ {
+ SetUndoComment(
+ ImpGetResStr(STR_EditMergeSubstractPoly),
+ aRemove.GetMarkDescription());
+ break;
+ }
+ case SdrMergeMode::Intersect:
+ {
+ SetUndoComment(
+ ImpGetResStr(STR_EditMergeIntersectPoly),
+ aRemove.GetMarkDescription());
+ break;
+ }
}
+ DeleteMarkedList(aRemove);
+
+ if( bUndo )
+ EndUndo();
}
void SdrEditView::EqualizeMarkedObjects(bool bWidth)
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index b88a0485577b..3e4775056414 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -1373,40 +1373,40 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction const & rAct)
{
basegfx::B2DRange aRange(rAct.GetRect().Left(), rAct.GetRect().Top(), rAct.GetRect().Right(), rAct.GetRect().Bottom());
- if(!aRange.isEmpty())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aRange.transform(aTransform);
- const Gradient& rGradient = rAct.GetGradient();
- SdrRectObj* pRect = new SdrRectObj(
- tools::Rectangle(
- floor(aRange.getMinX()),
- floor(aRange.getMinY()),
- ceil(aRange.getMaxX()),
- ceil(aRange.getMaxY())));
- // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
- SfxItemSet aGradientAttr(mpModel->GetItemPool(), pRect->GetMergedItemSet().GetRanges());
- const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
- const XFillGradientItem aXFillGradientItem(
- XGradient(
- rGradient.GetStartColor(),
- rGradient.GetEndColor(),
- aXGradientStyle,
- rGradient.GetAngle(),
- rGradient.GetOfsX(),
- rGradient.GetOfsY(),
- rGradient.GetBorder(),
- rGradient.GetStartIntensity(),
- rGradient.GetEndIntensity(),
- rGradient.GetSteps()));
-
- SetAttributes(pRect);
- aGradientAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // #i125211#
- aGradientAttr.Put(aXFillGradientItem);
- pRect->SetMergedItemSet(aGradientAttr);
-
- InsertObj(pRect, false);
- }
+ if(aRange.isEmpty())
+ return;
+
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aRange.transform(aTransform);
+ const Gradient& rGradient = rAct.GetGradient();
+ SdrRectObj* pRect = new SdrRectObj(
+ tools::Rectangle(
+ floor(aRange.getMinX()),
+ floor(aRange.getMinY()),
+ ceil(aRange.getMaxX()),
+ ceil(aRange.getMaxY())));
+ // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
+ SfxItemSet aGradientAttr(mpModel->GetItemPool(), pRect->GetMergedItemSet().GetRanges());
+ const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
+ const XFillGradientItem aXFillGradientItem(
+ XGradient(
+ rGradient.GetStartColor(),
+ rGradient.GetEndColor(),
+ aXGradientStyle,
+ rGradient.GetAngle(),
+ rGradient.GetOfsX(),
+ rGradient.GetOfsY(),
+ rGradient.GetBorder(),
+ rGradient.GetStartIntensity(),
+ rGradient.GetEndIntensity(),
+ rGradient.GetSteps()));
+
+ SetAttributes(pRect);
+ aGradientAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // #i125211#
+ aGradientAttr.Put(aXFillGradientItem);
+ pRect->SetMergedItemSet(aGradientAttr);
+
+ InsertObj(pRect, false);
}
void ImpSdrGDIMetaFileImport::DoAction(MetaTransparentAction const & rAct)
@@ -1469,185 +1469,185 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
{
const GDIMetaFile& rMtf = rAct.GetGDIMetaFile();
- if(rMtf.GetActionSize())
+ if(!rMtf.GetActionSize())
+ return;
+
+ const tools::Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
+
+ // convert metafile sub-content to BitmapEx
+ BitmapEx aBitmapEx(
+ convertMetafileToBitmapEx(
+ rMtf,
+ basegfx::B2DRange(
+ aRect.Left(), aRect.Top(),
+ aRect.Right(), aRect.Bottom()),
+ 125000));
+
+ // handle colors
+ const Gradient& rGradient = rAct.GetGradient();
+ basegfx::BColor aStart(rGradient.GetStartColor().getBColor());
+ basegfx::BColor aEnd(rGradient.GetEndColor().getBColor());
+
+ if(100 != rGradient.GetStartIntensity())
{
- const tools::Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
-
- // convert metafile sub-content to BitmapEx
- BitmapEx aBitmapEx(
- convertMetafileToBitmapEx(
- rMtf,
- basegfx::B2DRange(
- aRect.Left(), aRect.Top(),
- aRect.Right(), aRect.Bottom()),
- 125000));
-
- // handle colors
- const Gradient& rGradient = rAct.GetGradient();
- basegfx::BColor aStart(rGradient.GetStartColor().getBColor());
- basegfx::BColor aEnd(rGradient.GetEndColor().getBColor());
-
- if(100 != rGradient.GetStartIntensity())
- {
- aStart *= (double)rGradient.GetStartIntensity() / 100.0;
- }
+ aStart *= (double)rGradient.GetStartIntensity() / 100.0;
+ }
- if(100 != rGradient.GetEndIntensity())
- {
- aEnd *= (double)rGradient.GetEndIntensity() / 100.0;
- }
+ if(100 != rGradient.GetEndIntensity())
+ {
+ aEnd *= (double)rGradient.GetEndIntensity() / 100.0;
+ }
- const bool bEqualColors(aStart == aEnd);
- const bool bNoSteps(1 == rGradient.GetSteps());
- bool bCreateObject(true);
- bool bHasNewMask(false);
- AlphaMask aNewMask;
- double fTransparence(0.0);
- bool bFixedTransparence(false);
+ const bool bEqualColors(aStart == aEnd);
+ const bool bNoSteps(1 == rGradient.GetSteps());
+ bool bCreateObject(true);
+ bool bHasNewMask(false);
+ AlphaMask aNewMask;
+ double fTransparence(0.0);
+ bool bFixedTransparence(false);
- if(bEqualColors || bNoSteps)
- {
- // single transparence
- const basegfx::BColor aMedium(basegfx::average(aStart, aEnd));
- fTransparence = aMedium.luminance();
+ if(bEqualColors || bNoSteps)
+ {
+ // single transparence
+ const basegfx::BColor aMedium(basegfx::average(aStart, aEnd));
+ fTransparence = aMedium.luminance();
- if(basegfx::fTools::lessOrEqual(fTransparence, 0.0))
- {
- // no transparence needed, all done
- }
- else if(basegfx::fTools::moreOrEqual(fTransparence, 1.0))
- {
- // all transparent, no object
- bCreateObject = false;
- }
- else
- {
- // 0.0 < transparence < 1.0, apply fixed transparence
- bFixedTransparence = true;
- }
+ if(basegfx::fTools::lessOrEqual(fTransparence, 0.0))
+ {
+ // no transparence needed, all done
+ }
+ else if(basegfx::fTools::moreOrEqual(fTransparence, 1.0))
+ {
+ // all transparent, no object
+ bCreateObject = false;
}
else
{
- // gradient transparence
- ScopedVclPtrInstance< VirtualDevice > pVDev;
+ // 0.0 < transparence < 1.0, apply fixed transparence
+ bFixedTransparence = true;
+ }
+ }
+ else
+ {
+ // gradient transparence
+ ScopedVclPtrInstance< VirtualDevice > pVDev;
- pVDev->SetOutputSizePixel(aBitmapEx.GetBitmap().GetSizePixel());
- pVDev->DrawGradient(tools::Rectangle(Point(0, 0), pVDev->GetOutputSizePixel()), rGradient);
+ pVDev->SetOutputSizePixel(aBitmapEx.GetBitmap().GetSizePixel());
+ pVDev->DrawGradient(tools::Rectangle(Point(0, 0), pVDev->GetOutputSizePixel()), rGradient);
- aNewMask = AlphaMask(pVDev->GetBitmap(Point(0, 0), pVDev->GetOutputSizePixel()));
- bHasNewMask = true;
- }
+ aNewMask = AlphaMask(pVDev->GetBitmap(Point(0, 0), pVDev->GetOutputSizePixel()));
+ bHasNewMask = true;
+ }
- if(bCreateObject)
+ if(bCreateObject)
+ {
+ if(bHasNewMask || bFixedTransparence)
{
- if(bHasNewMask || bFixedTransparence)
+ if(!aBitmapEx.IsAlpha() && !aBitmapEx.IsTransparent())
{
- if(!aBitmapEx.IsAlpha() && !aBitmapEx.IsTransparent())
+ // no transparence yet, apply new one
+ if(bFixedTransparence)
{
- // no transparence yet, apply new one
- if(bFixedTransparence)
- {
- sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0));
+ sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0));
- aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha);
- }
+ aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha);
+ }
+
+ aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask);
+ }
+ else
+ {
+ // mix existing and new alpha mask
+ AlphaMask aOldMask;
- aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask);
+ if(aBitmapEx.IsAlpha())
+ {
+ aOldMask = aBitmapEx.GetAlpha();
}
- else
+ else if(TransparentType::Bitmap == aBitmapEx.GetTransparentType())
+ {
+ aOldMask = aBitmapEx.GetMask();
+ }
+ else if(TransparentType::Color == aBitmapEx.GetTransparentType())
{
- // mix existing and new alpha mask
- AlphaMask aOldMask;
+ aOldMask = aBitmapEx.GetBitmap().CreateMask(aBitmapEx.GetTransparentColor());
+ }
- if(aBitmapEx.IsAlpha())
- {
- aOldMask = aBitmapEx.GetAlpha();
- }
- else if(TransparentType::Bitmap == aBitmapEx.GetTransparentType())
- {
- aOldMask = aBitmapEx.GetMask();
- }
- else if(TransparentType::Color == aBitmapEx.GetTransparentType())
- {
- aOldMask = aBitmapEx.GetBitmap().CreateMask(aBitmapEx.GetTransparentColor());
- }
+ AlphaMask::ScopedWriteAccess pOld(aOldMask);
- AlphaMask::ScopedWriteAccess pOld(aOldMask);
+ if(pOld)
+ {
+ const double fFactor(1.0 / 255.0);
- if(pOld)
+ if(bFixedTransparence)
{
- const double fFactor(1.0 / 255.0);
+ const double fOpNew(1.0 - fTransparence);
- if(bFixedTransparence)
+ for(long y(0); y < pOld->Height(); y++)
{
- const double fOpNew(1.0 - fTransparence);
-
- for(long y(0); y < pOld->Height(); y++)
+ for(long x(0); x < pOld->Width(); x++)
{
- for(long x(0); x < pOld->Width(); x++)
- {
- const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor));
- const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0));
+ const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor));
+ const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0));
- pOld->SetPixel(y, x, BitmapColor(aCol));
- }
+ pOld->SetPixel(y, x, BitmapColor(aCol));
}
}
- else
- {
- AlphaMask::ScopedReadAccess pNew(aNewMask);
+ }
+ else
+ {
+ AlphaMask::ScopedReadAccess pNew(aNewMask);
- if(pNew)
+ if(pNew)
+ {
+ if(pOld->Width() == pNew->Width() && pOld->Height() == pNew->Height())
{
- if(pOld->Width() == pNew->Width() && pOld->Height() == pNew->Height())
+ for(long y(0); y < pOld->Height(); y++)
{
- for(long y(0); y < pOld->Height(); y++)
+ for(long x(0); x < pOld->Width(); x++)
{
- for(long x(0); x < pOld->Width(); x++)
- {
- const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor));
- const double fOpNew(1.0 - (pNew->GetPixel(y, x).GetIndex() * fFactor));
- const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0));
-
- pOld->SetPixel(y, x, BitmapColor(aCol));
- }
+ const double fOpOld(1.0 - (pOld->GetPixel(y, x).GetIndex() * fFactor));
+ const double fOpNew(1.0 - (pNew->GetPixel(y, x).GetIndex() * fFactor));
+ const sal_uInt8 aCol(basegfx::fround((1.0 - (fOpOld * fOpNew)) * 255.0));
+
+ pOld->SetPixel(y, x, BitmapColor(aCol));
}
}
- else
- {
- OSL_ENSURE(false, "Alpha masks have different sizes (!)");
- }
-
- pNew.reset();
}
else
{
- OSL_ENSURE(false, "Got no access to new alpha mask (!)");
+ OSL_ENSURE(false, "Alpha masks have different sizes (!)");
}
- }
- pOld.reset();
- }
- else
- {
- OSL_ENSURE(false, "Got no access to old alpha mask (!)");
+ pNew.reset();
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got no access to new alpha mask (!)");
+ }
}
- // apply combined bitmap as mask
- aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aOldMask);
+ pOld.reset();
+ }
+ else
+ {
+ OSL_ENSURE(false, "Got no access to old alpha mask (!)");
}
+
+ // apply combined bitmap as mask
+ aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aOldMask);
}
+ }
- // create and add object
- SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
+ // create and add object
+ SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
- // for MetaFloatTransparentAction, do not use SetAttributes(...)
- // since these metafile content is not used to draw line/fill
- // dependent of these setting at the device content
- pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
- pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
- InsertObj(pGraf);
- }
+ // for MetaFloatTransparentAction, do not use SetAttributes(...)
+ // since these metafile content is not used to draw line/fill
+ // dependent of these setting at the device content
+ pGraf->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
+ pGraf->SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
+ InsertObj(pGraf);
}
}
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 59c669382b37..930f98419589 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -1958,122 +1958,122 @@ void SdrHdlList::TravelFocusHdl(bool bForward)
if (mnFocusIndex >= GetHdlCount())
mnFocusIndex = SAL_MAX_SIZE;
- if(!aList.empty())
- {
- // take care of old handle
- const size_t nOldHdlNum(mnFocusIndex);
- SdrHdl* pOld = GetHdl(nOldHdlNum);
+ if(aList.empty())
+ return;
- if(pOld)
- {
- // switch off old handle
- mnFocusIndex = SAL_MAX_SIZE;
- pOld->Touch();
- }
+ // take care of old handle
+ const size_t nOldHdlNum(mnFocusIndex);
+ SdrHdl* pOld = GetHdl(nOldHdlNum);
+
+ if(pOld)
+ {
+ // switch off old handle
+ mnFocusIndex = SAL_MAX_SIZE;
+ pOld->Touch();
+ }
- // allocate pointer array for sorted handle list
- std::unique_ptr<ImplHdlAndIndex[]> pHdlAndIndex(new ImplHdlAndIndex[aList.size()]);
+ // allocate pointer array for sorted handle list
+ std::unique_ptr<ImplHdlAndIndex[]> pHdlAndIndex(new ImplHdlAndIndex[aList.size()]);
- // build sorted handle list
- for( size_t a = 0; a < aList.size(); ++a)
- {
- pHdlAndIndex[a].mpHdl = aList[a];
- pHdlAndIndex[a].mnIndex = a;
- }
+ // build sorted handle list
+ for( size_t a = 0; a < aList.size(); ++a)
+ {
+ pHdlAndIndex[a].mpHdl = aList[a];
+ pHdlAndIndex[a].mnIndex = a;
+ }
- qsort(pHdlAndIndex.get(), aList.size(), sizeof(ImplHdlAndIndex), ImplSortHdlFunc);
+ qsort(pHdlAndIndex.get(), aList.size(), sizeof(ImplHdlAndIndex), ImplSortHdlFunc);
- // look for old num in sorted array
- size_t nOldHdl(nOldHdlNum);
+ // look for old num in sorted array
+ size_t nOldHdl(nOldHdlNum);
- if(nOldHdlNum != SAL_MAX_SIZE)
+ if(nOldHdlNum != SAL_MAX_SIZE)
+ {
+ for(size_t a = 0; a < aList.size(); ++a)
{
- for(size_t a = 0; a < aList.size(); ++a)
+ if(pHdlAndIndex[a].mpHdl == pOld)
{
- if(pHdlAndIndex[a].mpHdl == pOld)
- {
- nOldHdl = a;
- break;
- }
+ nOldHdl = a;
+ break;
}
}
+ }
- // build new HdlNum
- size_t nNewHdl(nOldHdl);
+ // build new HdlNum
+ size_t nNewHdl(nOldHdl);
- // do the focus travel
- if(bForward)
+ // do the focus travel
+ if(bForward)
+ {
+ if(nOldHdl != SAL_MAX_SIZE)
{
- if(nOldHdl != SAL_MAX_SIZE)
+ if(nOldHdl == aList.size() - 1)
{
- if(nOldHdl == aList.size() - 1)
- {
- // end forward run
- nNewHdl = SAL_MAX_SIZE;
- }
- else
- {
- // simply the next handle
- nNewHdl++;
- }
+ // end forward run
+ nNewHdl = SAL_MAX_SIZE;
}
else
{
- // start forward run at first entry
- nNewHdl = 0;
+ // simply the next handle
+ nNewHdl++;
}
}
else
{
- if(nOldHdl == SAL_MAX_SIZE)
- {
- // start backward run at last entry
- nNewHdl = aList.size() - 1;
+ // start forward run at first entry
+ nNewHdl = 0;
+ }
+ }
+ else
+ {
+ if(nOldHdl == SAL_MAX_SIZE)
+ {
+ // start backward run at last entry
+ nNewHdl = aList.size() - 1;
+ }
+ else
+ {
+ if(nOldHdl == 0)
+ {
+ // end backward run
+ nNewHdl = SAL_MAX_SIZE;
}
else
{
- if(nOldHdl == 0)
- {
- // end backward run
- nNewHdl = SAL_MAX_SIZE;
- }
- else
- {
- // simply the previous handle
- nNewHdl--;
- }
+ // simply the previous handle
+ nNewHdl--;
}
}
+ }
- // build new HdlNum
- sal_uIntPtr nNewHdlNum(nNewHdl);
+ // build new HdlNum
+ sal_uIntPtr nNewHdlNum(nNewHdl);
- // look for old num in sorted array
- if(nNewHdl != SAL_MAX_SIZE)
- {
- SdrHdl* pNew = pHdlAndIndex[nNewHdl].mpHdl;
+ // look for old num in sorted array
+ if(nNewHdl != SAL_MAX_SIZE)
+ {
+ SdrHdl* pNew = pHdlAndIndex[nNewHdl].mpHdl;
- for(size_t a = 0; a < aList.size(); ++a)
+ for(size_t a = 0; a < aList.size(); ++a)
+ {
+ if(aList[a] == pNew)
{
- if(aList[a] == pNew)
- {
- nNewHdlNum = a;
- break;
- }
+ nNewHdlNum = a;
+ break;
}
}
+ }
- // take care of next handle
- if(nOldHdlNum != nNewHdlNum)
- {
- mnFocusIndex = nNewHdlNum;
- SdrHdl* pNew = GetHdl(mnFocusIndex);
+ // take care of next handle
+ if(nOldHdlNum != nNewHdlNum)
+ {
+ mnFocusIndex = nNewHdlNum;
+ SdrHdl* pNew = GetHdl(mnFocusIndex);
- if(pNew)
- {
- pNew->Touch();
- }
+ if(pNew)
+ {
+ pNew->Touch();
}
}
}
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index d1d5544c8994..3d71630005d0 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -653,300 +653,300 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
mpMarkedPV=nullptr;
// are handles enabled at all? Create only then
- if(!areMarkHandlesHidden())
+ if(areMarkHandlesHidden())
+ return;
+
+ const size_t nMarkCount=GetMarkedObjectCount();
+ bool bStdDrag=meDragMode==SdrDragMode::Move;
+ bool bSingleTextObjMark=false;
+ bool bLimitedRotation(false);
+
+ if (nMarkCount==1)
{
- const size_t nMarkCount=GetMarkedObjectCount();
- bool bStdDrag=meDragMode==SdrDragMode::Move;
- bool bSingleTextObjMark=false;
- bool bLimitedRotation(false);
+ mpMarkedObj=GetMarkedObjectByIndex(0);
- if (nMarkCount==1)
+ if(nullptr != mpMarkedObj)
{
- mpMarkedObj=GetMarkedObjectByIndex(0);
-
- if(nullptr != mpMarkedObj)
- {
- bSingleTextObjMark =
- mpMarkedObj &&
- dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr &&
- static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame();
+ bSingleTextObjMark =
+ mpMarkedObj &&
+ dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr &&
+ static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame();
- // RotGrfFlyFrame: we may have limited rotation
- bLimitedRotation = SdrDragMode::Rotate == meDragMode && mpMarkedObj->HasLimitedRotation();
- }
+ // RotGrfFlyFrame: we may have limited rotation
+ bLimitedRotation = SdrDragMode::Rotate == meDragMode && mpMarkedObj->HasLimitedRotation();
}
+ }
- bool bFrmHdl=ImpIsFrameHandles();
+ bool bFrmHdl=ImpIsFrameHandles();
- if (nMarkCount>0)
+ if (nMarkCount>0)
+ {
+ mpMarkedPV=GetSdrPageViewOfMarkedByIndex(0);
+
+ for (size_t nMarkNum=0; nMarkNum<nMarkCount && (mpMarkedPV!=nullptr || !bFrmHdl); ++nMarkNum)
{
- mpMarkedPV=GetSdrPageViewOfMarkedByIndex(0);
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
- for (size_t nMarkNum=0; nMarkNum<nMarkCount && (mpMarkedPV!=nullptr || !bFrmHdl); ++nMarkNum)
+ if (mpMarkedPV!=pM->GetPageView())
{
- const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
-
- if (mpMarkedPV!=pM->GetPageView())
- {
- mpMarkedPV=nullptr;
- }
+ mpMarkedPV=nullptr;
}
}
+ }
- // apply calc offset to marked object rect
- // ( necessary for handles to be displayed in
- // correct position )
- Point aGridOff = GetGridOffset();
+ // apply calc offset to marked object rect
+ // ( necessary for handles to be displayed in
+ // correct position )
+ Point aGridOff = GetGridOffset();
- // There can be multiple mark views, but we're only interested in the one that has a window associated.
- const bool bTiledRendering = comphelper::LibreOfficeKit::isActive() && GetFirstOutputDevice() && GetFirstOutputDevice()->GetOutDevType() == OUTDEV_WINDOW;
+ // There can be multiple mark views, but we're only interested in the one that has a window associated.
+ const bool bTiledRendering = comphelper::LibreOfficeKit::isActive() && GetFirstOutputDevice() && GetFirstOutputDevice()->GetOutDevType() == OUTDEV_WINDOW;
- // check if text edit or ole is active and handles need to be suppressed. This may be the case
- // when a single object is selected
- // Using a strict return statement is okay here; no handles means *no* handles.
- if(mpMarkedObj)
+ // check if text edit or ole is active and handles need to be suppressed. This may be the case
+ // when a single object is selected
+ // Using a strict return statement is okay here; no handles means *no* handles.
+ if(mpMarkedObj)
+ {
+ // formerly #i33755#: If TextEdit is active the EditEngine will directly paint
+ // to the window, so suppress Overlay and handles completely; a text frame for
+ // the active text edit will be painted by the repaint mechanism in
+ // SdrObjEditView::ImpPaintOutlinerView in this case. This needs to be reworked
+ // in the future
+ // Also formerly #122142#: Pretty much the same for SdrCaptionObj's in calc.
+ if(static_cast<SdrView*>(this)->IsTextEdit())
{
- // formerly #i33755#: If TextEdit is active the EditEngine will directly paint
- // to the window, so suppress Overlay and handles completely; a text frame for
- // the active text edit will be painted by the repaint mechanism in
- // SdrObjEditView::ImpPaintOutlinerView in this case. This needs to be reworked
- // in the future
- // Also formerly #122142#: Pretty much the same for SdrCaptionObj's in calc.
- if(static_cast<SdrView*>(this)->IsTextEdit())
- {
- const SdrTextObj* pSdrTextObj = dynamic_cast< const SdrTextObj* >(mpMarkedObj);
+ const SdrTextObj* pSdrTextObj = dynamic_cast< const SdrTextObj* >(mpMarkedObj);
- if(pSdrTextObj && pSdrTextObj->IsInEditMode())
+ if(pSdrTextObj && pSdrTextObj->IsInEditMode())
+ {
+ if (bTiledRendering)
{
- if (bTiledRendering)
+ // Suppress handles -> empty graphic selection.
+ if(SfxViewShell* pViewShell = GetSfxViewShell())
{
- // Suppress handles -> empty graphic selection.
- if(SfxViewShell* pViewShell = GetSfxViewShell())
- {
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY");
- SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
- }
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY");
+ SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
}
- return;
}
+ return;
}
+ }
- // formerly #i118524#: if inplace activated OLE is selected, suppress handles
- const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(mpMarkedObj);
+ // formerly #i118524#: if inplace activated OLE is selected, suppress handles
+ const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(mpMarkedObj);
- if(pSdrOle2Obj && (pSdrOle2Obj->isInplaceActive() || pSdrOle2Obj->isUiActive()))
- {
- return;
- }
+ if(pSdrOle2Obj && (pSdrOle2Obj->isInplaceActive() || pSdrOle2Obj->isUiActive()))
+ {
+ return;
+ }
- if (bTiledRendering && mpMarkedObj->GetObjIdentifier() == OBJ_TABLE)
+ if (bTiledRendering && mpMarkedObj->GetObjIdentifier() == OBJ_TABLE)
+ {
+ rtl::Reference<sdr::SelectionController> xController = static_cast<SdrView*>(this)->getSelectionController();
+ if (xController.is() && xController->hasSelectedCells())
{
- rtl::Reference<sdr::SelectionController> xController = static_cast<SdrView*>(this)->getSelectionController();
- if (xController.is() && xController->hasSelectedCells())
+ // The table shape has selected cells, which provide text selection already -> no graphic selection.
+ if(SfxViewShell* pViewShell = GetSfxViewShell())
{
- // The table shape has selected cells, which provide text selection already -> no graphic selection.
- if(SfxViewShell* pViewShell = GetSfxViewShell())
- {
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY");
- SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
- }
- return;
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY");
+ SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", "EMPTY");
}
+ return;
}
}
+ }
- tools::Rectangle aRect(GetMarkedObjRect());
- tools::Rectangle aSelection(aRect);
+ tools::Rectangle aRect(GetMarkedObjRect());
+ tools::Rectangle aSelection(aRect);
- if (bTiledRendering && !aRect.IsEmpty())
+ if (bTiledRendering && !aRect.IsEmpty())
+ {
+ sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
+ if (nTotalPaintWindows == 1)
{
- sal_uInt32 nTotalPaintWindows = this->PaintWindowCount();
- if (nTotalPaintWindows == 1)
+ const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
+ if (pWin && pWin->IsChart())
{
- const vcl::Window* pWin = dynamic_cast<const vcl::Window*>(this->GetFirstOutputDevice());
- if (pWin && pWin->IsChart())
+ const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
+ if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
{
- const vcl::Window* pViewShellWindow = GetSfxViewShell()->GetEditWindowForActiveOLEObj();
- if (pViewShellWindow && pViewShellWindow->IsAncestorOf(*pWin))
- {
- Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
- Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
- aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
- }
+ Point aOffsetPx = pWin->GetOffsetPixelFrom(*pViewShellWindow);
+ Point aLogicOffset = pWin->PixelToLogic(aOffsetPx);
+ aSelection.Move(aLogicOffset.getX(), aLogicOffset.getY());
}
}
}
+ }
- if (bTiledRendering)
+ if (bTiledRendering)
+ {
+ OString sSelection;
+ if (aSelection.IsEmpty())
+ sSelection = "EMPTY";
+ else
{
- OString sSelection;
- if (aSelection.IsEmpty())
- sSelection = "EMPTY";
- else
+ // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
+ if (mpMarkedPV)
{
- // In case the map mode is in 100th MM, then need to convert the coordinates over to twips for LOK.
- if (mpMarkedPV)
+ if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
{
- if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
- {
- if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
- aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
- }
+ if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
+ aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
}
+ }
- sSelection = aSelection.toString();
+ sSelection = aSelection.toString();
- // hide the text selection too
- if(SfxViewShell* pViewShell = GetSfxViewShell())
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "");
- }
+ // hide the text selection too
if(SfxViewShell* pViewShell = GetSfxViewShell())
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "");
+ }
+ if(SfxViewShell* pViewShell = GetSfxViewShell())
+ {
+ if (pOtherShell)
{
- if (pOtherShell)
- {
- // An other shell wants to know about our existing
- // selection.
- if (pViewShell != pOtherShell)
- SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection);
- }
- else
+ // An other shell wants to know about our existing
+ // selection.
+ if (pViewShell != pOtherShell)
+ SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection);
+ }
+ else
+ {
+ // We have a new selection, so both pViewShell and the
+ // other views want to know about it.
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelection.getStr());
+ SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection);
+ }
+ }
+ }
+
+ if (bFrmHdl)
+ {
+ if(!aRect.IsEmpty())
+ { // otherwise nothing is found
+ if( bSingleTextObjMark )
+ {
+ const size_t nSiz0=maHdlList.GetHdlCount();
+ mpMarkedObj->AddToHdlList(maHdlList);
+ const size_t nSiz1=maHdlList.GetHdlCount();
+ for (size_t i=nSiz0; i<nSiz1; ++i)
{
- // We have a new selection, so both pViewShell and the
- // other views want to know about it.
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelection.getStr());
- SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_GRAPHIC_VIEW_SELECTION, "selection", sSelection);
+ SdrHdl* pHdl=maHdlList.GetHdl(i);
+ pHdl->SetObj(mpMarkedObj);
+ pHdl->SetPos( pHdl->GetPos() + aGridOff );
+ pHdl->SetPageView(mpMarkedPV);
+ pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
}
}
- }
+ else
+ {
+ const bool bWdt0(aRect.Left() == aRect.Right());
+ const bool bHgt0(aRect.Top() == aRect.Bottom());
- if (bFrmHdl)
- {
- if(!aRect.IsEmpty())
- { // otherwise nothing is found
- if( bSingleTextObjMark )
+ if (bWdt0 && bHgt0)
{
- const size_t nSiz0=maHdlList.GetHdlCount();
- mpMarkedObj->AddToHdlList(maHdlList);
- const size_t nSiz1=maHdlList.GetHdlCount();
- for (size_t i=nSiz0; i<nSiz1; ++i)
- {
- SdrHdl* pHdl=maHdlList.GetHdl(i);
- pHdl->SetObj(mpMarkedObj);
- pHdl->SetPos( pHdl->GetPos() + aGridOff );
- pHdl->SetPageView(mpMarkedPV);
- pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
- }
+ maHdlList.AddHdl(new SdrHdl(aRect.TopLeft(), SdrHdlKind::UpperLeft));
+ }
+ else if (!bStdDrag && (bWdt0 || bHgt0))
+ {
+ maHdlList.AddHdl(new SdrHdl(aRect.TopLeft(), SdrHdlKind::UpperLeft));
+ maHdlList.AddHdl(new SdrHdl(aRect.BottomRight(), SdrHdlKind::LowerRight));
}
else
{
- const bool bWdt0(aRect.Left() == aRect.Right());
- const bool bHgt0(aRect.Top() == aRect.Bottom());
-
- if (bWdt0 && bHgt0)
+ if (!bWdt0 && !bHgt0)
{
maHdlList.AddHdl(new SdrHdl(aRect.TopLeft(), SdrHdlKind::UpperLeft));
}
- else if (!bStdDrag && (bWdt0 || bHgt0))
+
+ if (!bLimitedRotation && !bHgt0)
{
- maHdlList.AddHdl(new SdrHdl(aRect.TopLeft(), SdrHdlKind::UpperLeft));
- maHdlList.AddHdl(new SdrHdl(aRect.BottomRight(), SdrHdlKind::LowerRight));
+ maHdlList.AddHdl(new SdrHdl(aRect.TopCenter(), SdrHdlKind::Upper));
}
- else
- {
- if (!bWdt0 && !bHgt0)
- {
- maHdlList.AddHdl(new SdrHdl(aRect.TopLeft(), SdrHdlKind::UpperLeft));
- }
- if (!bLimitedRotation && !bHgt0)
- {
- maHdlList.AddHdl(new SdrHdl(aRect.TopCenter(), SdrHdlKind::Upper));
- }
-
- if (!bWdt0 && !bHgt0)
- {
- maHdlList.AddHdl(new SdrHdl(aRect.TopRight(), SdrHdlKind::UpperRight));
- }
+ if (!bWdt0 && !bHgt0)
+ {
+ maHdlList.AddHdl(new SdrHdl(aRect.TopRight(), SdrHdlKind::UpperRight));
+ }
- if (!bLimitedRotation && !bWdt0)
- {
- maHdlList.AddHdl(new SdrHdl(aRect.LeftCenter(), SdrHdlKind::Left ));
- }
+ if (!bLimitedRotation && !bWdt0)
+ {
+ maHdlList.AddHdl(new SdrHdl(aRect.LeftCenter(), SdrHdlKind::Left ));
+ }
- if (!bLimitedRotation && !bWdt0)
- {
- maHdlList.AddHdl(new SdrHdl(aRect.RightCenter(), SdrHdlKind::Right));
- }
+ if (!bLimitedRotation && !bWdt0)
+ {
+ maHdlList.AddHdl(new SdrHdl(aRect.RightCenter(), SdrHdlKind::Right));
+ }
- if (!bWdt0 && !bHgt0)
- {
- maHdlList.AddHdl(new SdrHdl(aRect.BottomLeft(), SdrHdlKind::LowerLeft));
- }
+ if (!bWdt0 && !bHgt0)
+ {
+ maHdlList.AddHdl(new SdrHdl(aRect.BottomLeft(), SdrHdlKind::LowerLeft));
+ }
- if (!bLimitedRotation && !bHgt0)
- {
- maHdlList.AddHdl(new SdrHdl(aRect.BottomCenter(), SdrHdlKind::Lower));
- }
+ if (!bLimitedRotation && !bHgt0)
+ {
+ maHdlList.AddHdl(new SdrHdl(aRect.BottomCenter(), SdrHdlKind::Lower));
+ }
- if (!bWdt0 && !bHgt0)
- {
- maHdlList.AddHdl(new SdrHdl(aRect.BottomRight(), SdrHdlKind::LowerRight));
- }
+ if (!bWdt0 && !bHgt0)
+ {
+ maHdlList.AddHdl(new SdrHdl(aRect.BottomRight(), SdrHdlKind::LowerRight));
}
}
}
}
- else
- {
- bool bDone(false);
+ }
+ else
+ {
+ bool bDone(false);
- // moved crop handling to non-frame part and the handle creation to SdrGrafObj
- if(1 == nMarkCount && mpMarkedObj && SdrDragMode::Crop == meDragMode)
- {
- // Default addCropHandles from SdrObject does nothing. When pMarkedObj is SdrGrafObj, previous
- // behaviour occurs (code in svx/source/svdraw/svdograf.cxx). When pMarkedObj is SwVirtFlyDrawObj
- // writer takes the responsibility of adding handles (code in sw/source/core/draw/dflyobj.cxx)
- mpMarkedObj->addCropHandles(maHdlList);
- bDone = true;
- }
+ // moved crop handling to non-frame part and the handle creation to SdrGrafObj
+ if(1 == nMarkCount && mpMarkedObj && SdrDragMode::Crop == meDragMode)
+ {
+ // Default addCropHandles from SdrObject does nothing. When pMarkedObj is SdrGrafObj, previous
+ // behaviour occurs (code in svx/source/svdraw/svdograf.cxx). When pMarkedObj is SwVirtFlyDrawObj
+ // writer takes the responsibility of adding handles (code in sw/source/core/draw/dflyobj.cxx)
+ mpMarkedObj->addCropHandles(maHdlList);
+ bDone = true;
+ }
- if(!bDone)
+ if(!bDone)
+ {
+ for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
{
- for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ const size_t nSiz0=maHdlList.GetHdlCount();
+ pObj->AddToHdlList(maHdlList);
+ const size_t nSiz1=maHdlList.GetHdlCount();
+ bool bPoly=pObj->IsPolyObj();
+ const SdrUShortCont& rMrkPnts = pM->GetMarkedPoints();
+ for (size_t i=nSiz0; i<nSiz1; ++i)
{
- const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrPageView* pPV=pM->GetPageView();
- const size_t nSiz0=maHdlList.GetHdlCount();
- pObj->AddToHdlList(maHdlList);
- const size_t nSiz1=maHdlList.GetHdlCount();
- bool bPoly=pObj->IsPolyObj();
- const SdrUShortCont& rMrkPnts = pM->GetMarkedPoints();
- for (size_t i=nSiz0; i<nSiz1; ++i)
- {
- SdrHdl* pHdl=maHdlList.GetHdl(i);
- pHdl->SetPos( pHdl->GetPos() + aGridOff );
- pHdl->SetObj(pObj);
- pHdl->SetPageView(pPV);
- pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
+ SdrHdl* pHdl=maHdlList.GetHdl(i);
+ pHdl->SetPos( pHdl->GetPos() + aGridOff );
+ pHdl->SetObj(pObj);
+ pHdl->SetPageView(pPV);
+ pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
- if (bPoly)
+ if (bPoly)
+ {
+ bool bSelected= rMrkPnts.find( sal_uInt16(i-nSiz0) ) != rMrkPnts.end();
+ pHdl->SetSelected(bSelected);
+ if (mbPlusHdlAlways || bSelected)
{
- bool bSelected= rMrkPnts.find( sal_uInt16(i-nSiz0) ) != rMrkPnts.end();
- pHdl->SetSelected(bSelected);
- if (mbPlusHdlAlways || bSelected)
+ sal_uInt32 nPlusHdlCnt=pObj->GetPlusHdlCount(*pHdl);
+ for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusHdlCnt; nPlusNum++)
{
- sal_uInt32 nPlusHdlCnt=pObj->GetPlusHdlCount(*pHdl);
- for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusHdlCnt; nPlusNum++)
+ SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,nPlusNum);
+ if (pPlusHdl!=nullptr)
{
- SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,nPlusNum);
- if (pPlusHdl!=nullptr)
- {
- pPlusHdl->SetObj(pObj);
- pPlusHdl->SetPageView(pPV);
- pPlusHdl->SetPlusHdl(true);
- maHdlList.AddHdl(pPlusHdl);
- }
+ pPlusHdl->SetObj(pObj);
+ pPlusHdl->SetPageView(pPV);
+ pPlusHdl->SetPlusHdl(true);
+ maHdlList.AddHdl(pPlusHdl);
}
}
}
@@ -954,64 +954,64 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
}
}
}
+ }
- // GluePoint handles
- for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
- {
- const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
- if (!pGPL)
- continue;
+ // GluePoint handles
+ for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
+ {
+ const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ if (!pGPL)
+ continue;
- SdrPageView* pPV=pM->GetPageView();
- const SdrUShortCont& rMrkGlue=pM->GetMarkedGluePoints();
- for (SdrUShortCont::const_iterator it = rMrkGlue.begin(); it != rMrkGlue.end(); ++it)
+ SdrPageView* pPV=pM->GetPageView();
+ const SdrUShortCont& rMrkGlue=pM->GetMarkedGluePoints();
+ for (SdrUShortCont::const_iterator it = rMrkGlue.begin(); it != rMrkGlue.end(); ++it)
+ {
+ sal_uInt16 nId=*it;
+ //nNum changed to nNumGP because already used in for loop
+ sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
+ if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
{
- sal_uInt16 nId=*it;
- //nNum changed to nNumGP because already used in for loop
- sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
- if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
- {
- const SdrGluePoint& rGP=(*pGPL)[nNumGP];
- Point aPos(rGP.GetAbsolutePos(*pObj));
- SdrHdl* pGlueHdl=new SdrHdl(aPos,SdrHdlKind::Glue);
- pGlueHdl->SetObj(pObj);
- pGlueHdl->SetPageView(pPV);
- pGlueHdl->SetObjHdlNum(nId);
- maHdlList.AddHdl(pGlueHdl);
- }
+ const SdrGluePoint& rGP=(*pGPL)[nNumGP];
+ Point aPos(rGP.GetAbsolutePos(*pObj));
+ SdrHdl* pGlueHdl=new SdrHdl(aPos,SdrHdlKind::Glue);
+ pGlueHdl->SetObj(pObj);
+ pGlueHdl->SetPageView(pPV);
+ pGlueHdl->SetObjHdlNum(nId);
+ maHdlList.AddHdl(pGlueHdl);
}
}
+ }
- // rotation point/axis of reflection
- if(!bLimitedRotation)
- {
- AddDragModeHdl(meDragMode);
- }
+ // rotation point/axis of reflection
+ if(!bLimitedRotation)
+ {
+ AddDragModeHdl(meDragMode);
+ }
- // sort handles
- maHdlList.Sort();
+ // sort handles
+ maHdlList.Sort();
- // add custom handles (used by other apps, e.g. AnchorPos)
- AddCustomHdl();
+ // add custom handles (used by other apps, e.g. AnchorPos)
+ AddCustomHdl();
- // try to restore focus handle index from remembered values
- if(bSaveOldFocus)
+ // try to restore focus handle index from remembered values
+ if(bSaveOldFocus)
+ {
+ for(size_t a = 0; a < maHdlList.GetHdlCount(); ++a)
{
- for(size_t a = 0; a < maHdlList.GetHdlCount(); ++a)
- {
- SdrHdl* pCandidate = maHdlList.GetHdl(a);
+ SdrHdl* pCandidate = maHdlList.GetHdl(a);
- if(pCandidate->GetObj()
- && pCandidate->GetObj() == pSaveObj
- && pCandidate->GetKind() == eSaveKind
- && pCandidate->GetPolyNum() == nSavePolyNum
- && pCandidate->GetPointNum() == nSavePointNum)
- {
- maHdlList.SetFocusHdl(pCandidate);
- break;
- }
+ if(pCandidate->GetObj()
+ && pCandidate->GetObj() == pSaveObj
+ && pCandidate->GetKind() == eSaveKind
+ && pCandidate->GetPolyNum() == nSavePolyNum
+ && pCandidate->GetPointNum() == nSavePointNum)
+ {
+ maHdlList.SetFocusHdl(pCandidate);
+ break;
}
}
}
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index b0eb00aeebd6..dfb0f1d2e779 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -607,27 +607,28 @@ void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fractio
void SdrObjGroup::Rotate(const Point& rRef, long nAngle, double sn, double cs)
{
- if (nAngle!=0) {
- SetGlueReallyAbsolute(true);
- tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
- RotatePoint(aRefPoint,rRef,sn,cs);
- // move the connectors first, everything else afterwards
- SdrObjList* pOL=pSub.get();
- const size_t nObjCount = pOL->GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=pOL->GetObj(i);
- if (pObj->IsEdgeObj()) pObj->Rotate(rRef,nAngle,sn,cs);
- }
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=pOL->GetObj(i);
- if (!pObj->IsEdgeObj()) pObj->Rotate(rRef,nAngle,sn,cs);
- }
- NbcRotateGluePoints(rRef,nAngle,sn,cs);
- SetGlueReallyAbsolute(false);
- SetChanged();
- BroadcastObjectChange();
- SendUserCall(SdrUserCallType::Resize,aBoundRect0);
+ if (nAngle==0)
+ return;
+
+ SetGlueReallyAbsolute(true);
+ tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
+ RotatePoint(aRefPoint,rRef,sn,cs);
+ // move the connectors first, everything else afterwards
+ SdrObjList* pOL=pSub.get();
+ const size_t nObjCount = pOL->GetObjCount();
+ for (size_t i=0; i<nObjCount; ++i) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (pObj->IsEdgeObj()) pObj->Rotate(rRef,nAngle,sn,cs);
}
+ for (size_t i=0; i<nObjCount; ++i) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (!pObj->IsEdgeObj()) pObj->Rotate(rRef,nAngle,sn,cs);
+ }
+ NbcRotateGluePoints(rRef,nAngle,sn,cs);
+ SetGlueReallyAbsolute(false);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SdrUserCallType::Resize,aBoundRect0);
}
@@ -657,27 +658,29 @@ void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
void SdrObjGroup::Shear(const Point& rRef, long nAngle, double tn, bool bVShear)
{
- if (nAngle!=0) {
- SetGlueReallyAbsolute(true);
- tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
- ShearPoint(aRefPoint,rRef,tn);
- // move the connectors first, everything else afterwards
- SdrObjList* pOL=pSub.get();
- const size_t nObjCount = pOL->GetObjCount();
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=pOL->GetObj(i);
- if (pObj->IsEdgeObj()) pObj->Shear(rRef,nAngle,tn,bVShear);
- }
- for (size_t i=0; i<nObjCount; ++i) {
- SdrObject* pObj=pOL->GetObj(i);
- if (!pObj->IsEdgeObj()) pObj->Shear(rRef,nAngle,tn,bVShear);
- }
- NbcShearGluePoints(rRef,tn,bVShear);
- SetGlueReallyAbsolute(false);
- SetChanged();
- BroadcastObjectChange();
- SendUserCall(SdrUserCallType::Resize,aBoundRect0);
+ if (nAngle==0)
+ return;
+
+ SetGlueReallyAbsolute(true);
+ tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
+ ShearPoint(aRefPoint,rRef,tn);
+ // move the connectors first, everything else afterwards
+ SdrObjList* pOL=pSub.get();
+ const size_t nObjCount = pOL->GetObjCount();
+ for (size_t i=0; i<nObjCount; ++i) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (pObj->IsEdgeObj()) pObj->Shear(rRef,nAngle,tn,bVShear);
+ }
+ for (size_t i=0; i<nObjCount; ++i) {
+ SdrObject* pObj=pOL->GetObj(i);
+ if (!pObj->IsEdgeObj()) pObj->Shear(rRef,nAngle,tn,bVShear);
}
+ NbcShearGluePoints(rRef,tn,bVShear);
+ SetGlueReallyAbsolute(false);
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SdrUserCallType::Resize,aBoundRect0);
+
}
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index c4f6e5acd8ff..b6344c3ad804 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -1685,24 +1685,24 @@ static tools::Rectangle lcl_ImpGetBoundRect(const basegfx::B2DPolyPolygon& rPoly
void SdrPathObj::ImpForceLineAngle()
{
- if(OBJ_LINE == meKind && lcl_ImpIsLine(GetPathPoly()))
- {
- const basegfx::B2DPolygon aPoly(GetPathPoly().getB2DPolygon(0));
- const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0));
- const basegfx::B2DPoint aB2DPoint1(aPoly.getB2DPoint(1));
- const Point aPoint0(FRound(aB2DPoint0.getX()), FRound(aB2DPoint0.getY()));
- const Point aPoint1(FRound(aB2DPoint1.getX()), FRound(aB2DPoint1.getY()));
- const Point aDelt(aPoint1 - aPoint0);
-
- aGeo.nRotationAngle=GetAngle(aDelt);
- aGeo.nShearAngle=0;
- aGeo.RecalcSinCos();
- aGeo.RecalcTan();
+ if(OBJ_LINE != meKind || !lcl_ImpIsLine(GetPathPoly()))
+ return;
+
+ const basegfx::B2DPolygon aPoly(GetPathPoly().getB2DPolygon(0));
+ const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0));
+ const basegfx::B2DPoint aB2DPoint1(aPoly.getB2DPoint(1));
+ const Point aPoint0(FRound(aB2DPoint0.getX()), FRound(aB2DPoint0.getY()));
+ const Point aPoint1(FRound(aB2DPoint1.getX()), FRound(aB2DPoint1.getY()));
+ const Point aDelt(aPoint1 - aPoint0);
+
+ aGeo.nRotationAngle=GetAngle(aDelt);
+ aGeo.nShearAngle=0;
+ aGeo.RecalcSinCos();
+ aGeo.RecalcTan();
- // for SdrTextObj, keep aRect up to date
- maRect = tools::Rectangle(aPoint0, aPoint1);
- maRect.Justify();
- }
+ // for SdrTextObj, keep aRect up to date
+ maRect = tools::Rectangle(aPoint0, aPoint1);
+ maRect.Justify();
}
void SdrPathObj::ImpForceKind()
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 9c943843d083..4662f70df497 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -189,23 +189,23 @@ void SdrTextObj::FitFrameToTextSize()
ImpJustifyRect(maRect);
SdrText* pText = getActiveText();
- if( pText!=nullptr && pText->GetOutlinerParaObject() && pModel!=nullptr)
- {
- SdrOutliner& rOutliner=ImpGetDrawOutliner();
- rOutliner.SetPaperSize(Size(maRect.Right()-maRect.Left(),maRect.Bottom()-maRect.Top()));
- rOutliner.SetUpdateMode(true);
- rOutliner.SetText(*pText->GetOutlinerParaObject());
- Size aNewSize(rOutliner.CalcTextSize());
- rOutliner.Clear();
- aNewSize.Width()++; // because of possible rounding errors
- aNewSize.Width()+=GetTextLeftDistance()+GetTextRightDistance();
- aNewSize.Height()+=GetTextUpperDistance()+GetTextLowerDistance();
- tools::Rectangle aNewRect(maRect);
- aNewRect.SetSize(aNewSize);
- ImpJustifyRect(aNewRect);
- if (aNewRect!=maRect) {
- SetLogicRect(aNewRect);
- }
+ if( pText==nullptr || !pText->GetOutlinerParaObject() || pModel==nullptr)
+ return;
+
+ SdrOutliner& rOutliner=ImpGetDrawOutliner();
+ rOutliner.SetPaperSize(Size(maRect.Right()-maRect.Left(),maRect.Bottom()-maRect.Top()));
+ rOutliner.SetUpdateMode(true);
+ rOutliner.SetText(*pText->GetOutlinerParaObject());
+ Size aNewSize(rOutliner.CalcTextSize());
+ rOutliner.Clear();
+ aNewSize.Width()++; // because of possible rounding errors
+ aNewSize.Width()+=GetTextLeftDistance()+GetTextRightDistance();
+ aNewSize.Height()+=GetTextUpperDistance()+GetTextLowerDistance();
+ tools::Rectangle aNewRect(maRect);
+ aNewRect.SetSize(aNewSize);
+ ImpJustifyRect(aNewRect);
+ if (aNewRect!=maRect) {
+ SetLogicRect(aNewRect);
}
}
@@ -1530,60 +1530,60 @@ void SdrTextObj::SetVerticalWriting(bool bVertical)
pOutlinerParaObject = GetOutlinerParaObject();
}
- if (pOutlinerParaObject &&
- (pOutlinerParaObject->IsVertical() != bVertical))
- {
- // get item settings
- const SfxItemSet& rSet = GetObjectItemSet();
- bool bAutoGrowWidth = rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue();
- bool bAutoGrowHeight = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
+ if (!pOutlinerParaObject ||
+ (pOutlinerParaObject->IsVertical() == bVertical))
+ return;
- // Also exchange hor/ver adjust items
- SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
- SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
+ // get item settings
+ const SfxItemSet& rSet = GetObjectItemSet();
+ bool bAutoGrowWidth = rSet.Get(SDRATTR_TEXT_AUTOGROWWIDTH).GetValue();
+ bool bAutoGrowHeight = rSet.Get(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue();
- // rescue object size
- tools::Rectangle aObjectRect = GetSnapRect();
+ // Also exchange hor/ver adjust items
+ SdrTextHorzAdjust eHorz = rSet.Get(SDRATTR_TEXT_HORZADJUST).GetValue();
+ SdrTextVertAdjust eVert = rSet.Get(SDRATTR_TEXT_VERTADJUST).GetValue();
- // prepare ItemSet to set exchanged width and height items
- SfxItemSet aNewSet(*rSet.GetPool(),
- svl::Items<SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
- // Expanded item ranges to also support hor and ver adjust.
- SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST,
- SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST>{});
+ // rescue object size
+ tools::Rectangle aObjectRect = GetSnapRect();
- aNewSet.Put(rSet);
- aNewSet.Put(makeSdrTextAutoGrowWidthItem(bAutoGrowHeight));
- aNewSet.Put(makeSdrTextAutoGrowHeightItem(bAutoGrowWidth));
+ // prepare ItemSet to set exchanged width and height items
+ SfxItemSet aNewSet(*rSet.GetPool(),
+ svl::Items<SDRATTR_TEXT_AUTOGROWHEIGHT, SDRATTR_TEXT_AUTOGROWHEIGHT,
+ // Expanded item ranges to also support hor and ver adjust.
+ SDRATTR_TEXT_VERTADJUST, SDRATTR_TEXT_VERTADJUST,
+ SDRATTR_TEXT_AUTOGROWWIDTH, SDRATTR_TEXT_HORZADJUST>{});
- // Exchange horz and vert adjusts
- switch (eVert)
- {
- case SDRTEXTVERTADJUST_TOP: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); break;
- case SDRTEXTVERTADJUST_CENTER: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); break;
- case SDRTEXTVERTADJUST_BOTTOM: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); break;
- case SDRTEXTVERTADJUST_BLOCK: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); break;
- }
- switch (eHorz)
- {
- case SDRTEXTHORZADJUST_LEFT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); break;
- case SDRTEXTHORZADJUST_CENTER: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); break;
- case SDRTEXTHORZADJUST_RIGHT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); break;
- case SDRTEXTHORZADJUST_BLOCK: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); break;
- }
+ aNewSet.Put(rSet);
+ aNewSet.Put(makeSdrTextAutoGrowWidthItem(bAutoGrowHeight));
+ aNewSet.Put(makeSdrTextAutoGrowHeightItem(bAutoGrowWidth));
- SetObjectItemSet(aNewSet);
+ // Exchange horz and vert adjusts
+ switch (eVert)
+ {
+ case SDRTEXTVERTADJUST_TOP: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT)); break;
+ case SDRTEXTVERTADJUST_CENTER: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_CENTER)); break;
+ case SDRTEXTVERTADJUST_BOTTOM: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT)); break;
+ case SDRTEXTVERTADJUST_BLOCK: aNewSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_BLOCK)); break;
+ }
+ switch (eHorz)
+ {
+ case SDRTEXTHORZADJUST_LEFT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BOTTOM)); break;
+ case SDRTEXTHORZADJUST_CENTER: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_CENTER)); break;
+ case SDRTEXTHORZADJUST_RIGHT: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP)); break;
+ case SDRTEXTHORZADJUST_BLOCK: aNewSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_BLOCK)); break;
+ }
- pOutlinerParaObject = GetOutlinerParaObject();
- if (pOutlinerParaObject)
- {
- // set ParaObject orientation accordingly
- pOutlinerParaObject->SetVertical(bVertical);
- }
+ SetObjectItemSet(aNewSet);
- // restore object size
- SetSnapRect(aObjectRect);
+ pOutlinerParaObject = GetOutlinerParaObject();
+ if (pOutlinerParaObject)
+ {
+ // set ParaObject orientation accordingly
+ pOutlinerParaObject->SetVertical(bVertical);
}
+
+ // restore object size
+ SetSnapRect(aObjectRect);
}
// transformation interface for StarOfficeAPI. This implements support for
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 859fc4639e63..940bdaad2205 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -170,276 +170,276 @@ namespace
void impTextBreakupHandler::impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo)
{
- if(!rInfo.maText.isEmpty() && rInfo.mnTextLen)
+ if(rInfo.maText.isEmpty() || !rInfo.mnTextLen)
+ return;
+
+ OUString caseMappedText = rInfo.mrFont.CalcCaseMap( rInfo.maText );
+ basegfx::B2DVector aFontScaling;
+ drawinglayer::attribute::FontAttribute aFontAttribute(
+ drawinglayer::primitive2d::getFontAttributeFromVclFont(
+ aFontScaling,
+ rInfo.mrFont,
+ rInfo.IsRTL(),
+ false));
+ basegfx::B2DHomMatrix aNewTransform;
+
+ // add font scale to new transform
+ aNewTransform.scale(aFontScaling.getX(), aFontScaling.getY());
+
+ // look for proportional font scaling, if necessary, scale accordingly
+ if(100 != rInfo.mrFont.GetPropr())
+ {
+ const double fFactor(rInfo.mrFont.GetPropr() / 100.0);
+ aNewTransform.scale(fFactor, fFactor);
+ }
+
+ // apply font rotate
+ if(rInfo.mrFont.GetOrientation())
{
- OUString caseMappedText = rInfo.mrFont.CalcCaseMap( rInfo.maText );
- basegfx::B2DVector aFontScaling;
- drawinglayer::attribute::FontAttribute aFontAttribute(
- drawinglayer::primitive2d::getFontAttributeFromVclFont(
- aFontScaling,
- rInfo.mrFont,
- rInfo.IsRTL(),
- false));
- basegfx::B2DHomMatrix aNewTransform;
-
- // add font scale to new transform
- aNewTransform.scale(aFontScaling.getX(), aFontScaling.getY());
-
- // look for proportional font scaling, if necessary, scale accordingly
- if(100 != rInfo.mrFont.GetPropr())
+ aNewTransform.rotate(-rInfo.mrFont.GetOrientation() * F_PI1800);
+ }
+
+ // look for escapement, if necessary, translate accordingly
+ if(rInfo.mrFont.GetEscapement())
+ {
+ sal_Int16 nEsc(rInfo.mrFont.GetEscapement());
+
+ if(DFLT_ESC_AUTO_SUPER == nEsc)
{
- const double fFactor(rInfo.mrFont.GetPropr() / 100.0);
- aNewTransform.scale(fFactor, fFactor);
+ nEsc = 33;
}
-
- // apply font rotate
- if(rInfo.mrFont.GetOrientation())
+ else if(DFLT_ESC_AUTO_SUB == nEsc)
{
- aNewTransform.rotate(-rInfo.mrFont.GetOrientation() * F_PI1800);
+ nEsc = -20;
}
- // look for escapement, if necessary, translate accordingly
- if(rInfo.mrFont.GetEscapement())
+ if(nEsc > 100)
{
- sal_Int16 nEsc(rInfo.mrFont.GetEscapement());
-
- if(DFLT_ESC_AUTO_SUPER == nEsc)
- {
- nEsc = 33;
- }
- else if(DFLT_ESC_AUTO_SUB == nEsc)
- {
- nEsc = -20;
- }
+ nEsc = 100;
+ }
+ else if(nEsc < -100)
+ {
+ nEsc = -100;
+ }
- if(nEsc > 100)
- {
- nEsc = 100;
- }
- else if(nEsc < -100)
- {
- nEsc = -100;
- }
+ const double fEscapement(nEsc / -100.0);
+ aNewTransform.translate(0.0, fEscapement * aFontScaling.getY());
+ }
- const double fEscapement(nEsc / -100.0);
- aNewTransform.translate(0.0, fEscapement * aFontScaling.getY());
- }
+ // apply transformA
+ aNewTransform *= maNewTransformA;
- // apply transformA
- aNewTransform *= maNewTransformA;
+ // apply local offset
+ aNewTransform.translate(rInfo.mrStartPos.X(), rInfo.mrStartPos.Y());
- // apply local offset
- aNewTransform.translate(rInfo.mrStartPos.X(), rInfo.mrStartPos.Y());
+ // also apply embedding object's transform
+ aNewTransform *= maNewTransformB;
- // also apply embedding object's transform
- aNewTransform *= maNewTransformB;
+ // prepare DXArray content. To make it independent from font size (and such from
+ // the text transformation), scale it to unit coordinates
+ ::std::vector< double > aDXArray;
+ static bool bDisableTextArray(false);
- // prepare DXArray content. To make it independent from font size (and such from
- // the text transformation), scale it to unit coordinates
- ::std::vector< double > aDXArray;
- static bool bDisableTextArray(false);
+ if(!bDisableTextArray && rInfo.mpDXArray && rInfo.mnTextLen)
+ {
+ aDXArray.reserve(rInfo.mnTextLen);
- if(!bDisableTextArray && rInfo.mpDXArray && rInfo.mnTextLen)
+ for(sal_Int32 a=0; a < rInfo.mnTextLen; a++)
{
- aDXArray.reserve(rInfo.mnTextLen);
-
- for(sal_Int32 a=0; a < rInfo.mnTextLen; a++)
- {
- aDXArray.push_back((double)rInfo.mpDXArray[a]);
- }
+ aDXArray.push_back((double)rInfo.mpDXArray[a]);
}
+ }
- // create complex text primitive and append
- const Color aFontColor(rInfo.mrFont.GetColor());
- const basegfx::BColor aBFontColor(aFontColor.getBColor());
-
- const Color aTextFillColor(rInfo.mrFont.GetFillColor());
-
- // prepare wordLineMode (for underline and strikeout)
- // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)'
- // to be split which would not look like the original
- const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet);
-
- // prepare new primitive
- drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = nullptr;
- const bool bDecoratedIsNeeded(
- LINESTYLE_NONE != rInfo.mrFont.GetOverline()
- || LINESTYLE_NONE != rInfo.mrFont.GetUnderline()
- || STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout()
- || FontEmphasisMark::NONE != (rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::Style)
- || FontRelief::NONE != rInfo.mrFont.GetRelief()
- || rInfo.mrFont.IsShadow()
- || bWordLineMode);
-
- if(bDecoratedIsNeeded)
+ // create complex text primitive and append
+ const Color aFontColor(rInfo.mrFont.GetColor());
+ const basegfx::BColor aBFontColor(aFontColor.getBColor());
+
+ const Color aTextFillColor(rInfo.mrFont.GetFillColor());
+
+ // prepare wordLineMode (for underline and strikeout)
+ // NOT for bullet texts. It is set (this may be an error by itself), but needs to be suppressed to hinder e.g. '1)'
+ // to be split which would not look like the original
+ const bool bWordLineMode(rInfo.mrFont.IsWordLineMode() && !rInfo.mbEndOfBullet);
+
+ // prepare new primitive
+ drawinglayer::primitive2d::BasePrimitive2D* pNewPrimitive = nullptr;
+ const bool bDecoratedIsNeeded(
+ LINESTYLE_NONE != rInfo.mrFont.GetOverline()
+ || LINESTYLE_NONE != rInfo.mrFont.GetUnderline()
+ || STRIKEOUT_NONE != rInfo.mrFont.GetStrikeout()
+ || FontEmphasisMark::NONE != (rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::Style)
+ || FontRelief::NONE != rInfo.mrFont.GetRelief()
+ || rInfo.mrFont.IsShadow()
+ || bWordLineMode);
+
+ if(bDecoratedIsNeeded)
+ {
+ // TextDecoratedPortionPrimitive2D needed, prepare some more data
+ // get overline and underline color. If it's on automatic (0xffffffff) use FontColor instead
+ const Color aUnderlineColor(rInfo.maTextLineColor);
+ const basegfx::BColor aBUnderlineColor((0xffffffff == aUnderlineColor.GetColor()) ? aBFontColor : aUnderlineColor.getBColor());
+ const Color aOverlineColor(rInfo.maOverlineColor);
+ const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor());
+
+ // prepare overline and underline data
+ const drawinglayer::primitive2d::TextLine eFontOverline(
+ drawinglayer::primitive2d::mapFontLineStyleToTextLine(rInfo.mrFont.GetOverline()));
+ const drawinglayer::primitive2d::TextLine eFontLineStyle(
+ drawinglayer::primitive2d::mapFontLineStyleToTextLine(rInfo.mrFont.GetUnderline()));
+
+ // check UnderlineAbove
+ const bool bUnderlineAbove(
+ drawinglayer::primitive2d::TEXT_LINE_NONE != eFontLineStyle && impIsUnderlineAbove(rInfo.mrFont));
+
+ // prepare strikeout data
+ const drawinglayer::primitive2d::TextStrikeout eTextStrikeout(
+ drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rInfo.mrFont.GetStrikeout()));
+
+ // prepare emphasis mark data
+ drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_NONE);
+
+ switch(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::Style)
{
- // TextDecoratedPortionPrimitive2D needed, prepare some more data
- // get overline and underline color. If it's on automatic (0xffffffff) use FontColor instead
- const Color aUnderlineColor(rInfo.maTextLineColor);
- const basegfx::BColor aBUnderlineColor((0xffffffff == aUnderlineColor.GetColor()) ? aBFontColor : aUnderlineColor.getBColor());
- const Color aOverlineColor(rInfo.maOverlineColor);
- const basegfx::BColor aBOverlineColor((0xffffffff == aOverlineColor.GetColor()) ? aBFontColor : aOverlineColor.getBColor());
-
- // prepare overline and underline data
- const drawinglayer::primitive2d::TextLine eFontOverline(
- drawinglayer::primitive2d::mapFontLineStyleToTextLine(rInfo.mrFont.GetOverline()));
- const drawinglayer::primitive2d::TextLine eFontLineStyle(
- drawinglayer::primitive2d::mapFontLineStyleToTextLine(rInfo.mrFont.GetUnderline()));
-
- // check UnderlineAbove
- const bool bUnderlineAbove(
- drawinglayer::primitive2d::TEXT_LINE_NONE != eFontLineStyle && impIsUnderlineAbove(rInfo.mrFont));
-
- // prepare strikeout data
- const drawinglayer::primitive2d::TextStrikeout eTextStrikeout(
- drawinglayer::primitive2d::mapFontStrikeoutToTextStrikeout(rInfo.mrFont.GetStrikeout()));
-
- // prepare emphasis mark data
- drawinglayer::primitive2d::TextEmphasisMark eTextEmphasisMark(drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_NONE);
-
- switch(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::Style)
- {
- case FontEmphasisMark::Dot : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_DOT; break;
- case FontEmphasisMark::Circle : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_CIRCLE; break;
- case FontEmphasisMark::Disc : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_DISC; break;
- case FontEmphasisMark::Accent : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_ACCENT; break;
- default: break;
- }
+ case FontEmphasisMark::Dot : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_DOT; break;
+ case FontEmphasisMark::Circle : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_CIRCLE; break;
+ case FontEmphasisMark::Disc : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_DISC; break;
+ case FontEmphasisMark::Accent : eTextEmphasisMark = drawinglayer::primitive2d::TEXT_FONT_EMPHASIS_MARK_ACCENT; break;
+ default: break;
+ }
- const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::PosAbove);
- const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::PosBelow);
+ const bool bEmphasisMarkAbove(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::PosAbove);
+ const bool bEmphasisMarkBelow(rInfo.mrFont.GetEmphasisMark() & FontEmphasisMark::PosBelow);
- // prepare font relief data
- drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE);
+ // prepare font relief data
+ drawinglayer::primitive2d::TextRelief eTextRelief(drawinglayer::primitive2d::TEXT_RELIEF_NONE);
- switch(rInfo.mrFont.GetRelief())
- {
- case FontRelief::Embossed : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_EMBOSSED; break;
- case FontRelief::Engraved : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_ENGRAVED; break;
- default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE
- }
-
- // prepare shadow/outline data
- const bool bShadow(rInfo.mrFont.IsShadow());
-
- // TextDecoratedPortionPrimitive2D is needed, create one
- pNewPrimitive = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D(
-
- // attributes for TextSimplePortionPrimitive2D
- aNewTransform,
- caseMappedText,
- rInfo.mnTextStart,
- rInfo.mnTextLen,
- aDXArray,
- aFontAttribute,
- rInfo.mpLocale ? *rInfo.mpLocale : css::lang::Locale(),
- aBFontColor,
- aTextFillColor,
-
- // attributes for TextDecoratedPortionPrimitive2D
- aBOverlineColor,
- aBUnderlineColor,
- eFontOverline,
- eFontLineStyle,
- bUnderlineAbove,
- eTextStrikeout,
- bWordLineMode,
- eTextEmphasisMark,
- bEmphasisMarkAbove,
- bEmphasisMarkBelow,
- eTextRelief,
- bShadow);
- }
- else
+ switch(rInfo.mrFont.GetRelief())
{
- // TextSimplePortionPrimitive2D is enough
- pNewPrimitive = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
- aNewTransform,
- caseMappedText,
- rInfo.mnTextStart,
- rInfo.mnTextLen,
- aDXArray,
- aFontAttribute,
- rInfo.mpLocale ? *rInfo.mpLocale : css::lang::Locale(),
- aBFontColor,
- rInfo.mbFilled,
- rInfo.mnWidthToFill,
- aTextFillColor);
+ case FontRelief::Embossed : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_EMBOSSED; break;
+ case FontRelief::Engraved : eTextRelief = drawinglayer::primitive2d::TEXT_RELIEF_ENGRAVED; break;
+ default : break; // RELIEF_NONE, FontRelief_FORCE_EQUAL_SIZE
}
- if(rInfo.mbEndOfBullet)
- {
- // embed in TextHierarchyBulletPrimitive2D
- const drawinglayer::primitive2d::Primitive2DReference aNewReference(pNewPrimitive);
- const drawinglayer::primitive2d::Primitive2DContainer aNewSequence { aNewReference } ;
- pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
- }
+ // prepare shadow/outline data
+ const bool bShadow(rInfo.mrFont.IsShadow());
+
+ // TextDecoratedPortionPrimitive2D is needed, create one
+ pNewPrimitive = new drawinglayer::primitive2d::TextDecoratedPortionPrimitive2D(
+
+ // attributes for TextSimplePortionPrimitive2D
+ aNewTransform,
+ caseMappedText,
+ rInfo.mnTextStart,
+ rInfo.mnTextLen,
+ aDXArray,
+ aFontAttribute,
+ rInfo.mpLocale ? *rInfo.mpLocale : css::lang::Locale(),
+ aBFontColor,
+ aTextFillColor,
+
+ // attributes for TextDecoratedPortionPrimitive2D
+ aBOverlineColor,
+ aBUnderlineColor,
+ eFontOverline,
+ eFontLineStyle,
+ bUnderlineAbove,
+ eTextStrikeout,
+ bWordLineMode,
+ eTextEmphasisMark,
+ bEmphasisMarkAbove,
+ bEmphasisMarkBelow,
+ eTextRelief,
+ bShadow);
+ }
+ else
+ {
+ // TextSimplePortionPrimitive2D is enough
+ pNewPrimitive = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
+ aNewTransform,
+ caseMappedText,
+ rInfo.mnTextStart,
+ rInfo.mnTextLen,
+ aDXArray,
+ aFontAttribute,
+ rInfo.mpLocale ? *rInfo.mpLocale : css::lang::Locale(),
+ aBFontColor,
+ rInfo.mbFilled,
+ rInfo.mnWidthToFill,
+ aTextFillColor);
+ }
- if(rInfo.mpFieldData)
- {
- pNewPrimitive = impCheckFieldPrimitive(pNewPrimitive, rInfo);
- }
+ if(rInfo.mbEndOfBullet)
+ {
+ // embed in TextHierarchyBulletPrimitive2D
+ const drawinglayer::primitive2d::Primitive2DReference aNewReference(pNewPrimitive);
+ const drawinglayer::primitive2d::Primitive2DContainer aNewSequence { aNewReference } ;
+ pNewPrimitive = new drawinglayer::primitive2d::TextHierarchyBulletPrimitive2D(aNewSequence);
+ }
- maTextPortionPrimitives.push_back(pNewPrimitive);
+ if(rInfo.mpFieldData)
+ {
+ pNewPrimitive = impCheckFieldPrimitive(pNewPrimitive, rInfo);
+ }
- // support for WrongSpellVector. Create WrongSpellPrimitives as needed
- if(rInfo.mpWrongSpellVector && !aDXArray.empty())
+ maTextPortionPrimitives.push_back(pNewPrimitive);
+
+ // support for WrongSpellVector. Create WrongSpellPrimitives as needed
+ if(rInfo.mpWrongSpellVector && !aDXArray.empty())
+ {
+ const sal_Int32 nSize(rInfo.mpWrongSpellVector->size());
+ const sal_Int32 nDXCount(aDXArray.size());
+ const basegfx::BColor aSpellColor(1.0, 0.0, 0.0); // red, hard coded
+
+ for(sal_Int32 a(0); a < nSize; a++)
{
- const sal_Int32 nSize(rInfo.mpWrongSpellVector->size());
- const sal_Int32 nDXCount(aDXArray.size());
- const basegfx::BColor aSpellColor(1.0, 0.0, 0.0); // red, hard coded
+ const EEngineData::WrongSpellClass& rCandidate = (*rInfo.mpWrongSpellVector)[a];
- for(sal_Int32 a(0); a < nSize; a++)
+ if(rCandidate.nStart >= rInfo.mnTextStart && rCandidate.nEnd >= rInfo.mnTextStart && rCandidate.nEnd > rCandidate.nStart)
{
- const EEngineData::WrongSpellClass& rCandidate = (*rInfo.mpWrongSpellVector)[a];
+ const sal_Int32 nStart(rCandidate.nStart - rInfo.mnTextStart);
+ const sal_Int32 nEnd(rCandidate.nEnd - rInfo.mnTextStart);
+ double fStart(0.0);
+ double fEnd(0.0);
- if(rCandidate.nStart >= rInfo.mnTextStart && rCandidate.nEnd >= rInfo.mnTextStart && rCandidate.nEnd > rCandidate.nStart)
+ if(nStart > 0 && nStart - 1 < nDXCount)
{
- const sal_Int32 nStart(rCandidate.nStart - rInfo.mnTextStart);
- const sal_Int32 nEnd(rCandidate.nEnd - rInfo.mnTextStart);
- double fStart(0.0);
- double fEnd(0.0);
+ fStart = aDXArray[nStart - 1];
+ }
- if(nStart > 0 && nStart - 1 < nDXCount)
- {
- fStart = aDXArray[nStart - 1];
- }
+ if(nEnd > 0 && nEnd - 1 < nDXCount)
+ {
+ fEnd = aDXArray[nEnd - 1];
+ }
- if(nEnd > 0 && nEnd - 1 < nDXCount)
+ if(!basegfx::fTools::equal(fStart, fEnd))
+ {
+ if(rInfo.IsRTL())
{
- fEnd = aDXArray[nEnd - 1];
+ // #i98523#
+ // When the portion is RTL, mirror the redlining using the
+ // full portion width
+ const double fTextWidth(aDXArray[aDXArray.size() - 1]);
+
+ fStart = fTextWidth - fStart;
+ fEnd = fTextWidth - fEnd;
}
- if(!basegfx::fTools::equal(fStart, fEnd))
+ // need to take FontScaling out of values; it's already part of
+ // aNewTransform and would be double applied
+ const double fFontScaleX(aFontScaling.getX());
+
+ if(!basegfx::fTools::equal(fFontScaleX, 1.0)
+ && !basegfx::fTools::equalZero(fFontScaleX))
{
- if(rInfo.IsRTL())
- {
- // #i98523#
- // When the portion is RTL, mirror the redlining using the
- // full portion width
- const double fTextWidth(aDXArray[aDXArray.size() - 1]);
-
- fStart = fTextWidth - fStart;
- fEnd = fTextWidth - fEnd;
- }
-
- // need to take FontScaling out of values; it's already part of
- // aNewTransform and would be double applied
- const double fFontScaleX(aFontScaling.getX());
-
- if(!basegfx::fTools::equal(fFontScaleX, 1.0)
- && !basegfx::fTools::equalZero(fFontScaleX))
- {
- fStart /= fFontScaleX;
- fEnd /= fFontScaleX;
- }
-
- maTextPortionPrimitives.push_back(new drawinglayer::primitive2d::WrongSpellPrimitive2D(
- aNewTransform,
- fStart,
- fEnd,
- aSpellColor));
+ fStart /= fFontScaleX;
+ fEnd /= fFontScaleX;
}
+
+ maTextPortionPrimitives.push_back(new drawinglayer::primitive2d::WrongSpellPrimitive2D(
+ aNewTransform,
+ fStart,
+ fEnd,
+ aSpellColor));
}
}
}
@@ -1205,34 +1205,34 @@ void SdrTextObj::impDecomposeStretchTextPrimitive(
void SdrTextObj::impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const
{
- if(SdrTextAniKind::Blink == GetTextAniKind())
- {
- // get values
- const SfxItemSet& rSet = GetObjectItemSet();
- const sal_uInt32 nRepeat((sal_uInt32)rSet.Get(SDRATTR_TEXT_ANICOUNT).GetValue());
- double fDelay((double)rSet.Get(SDRATTR_TEXT_ANIDELAY).GetValue());
+ if(SdrTextAniKind::Blink != GetTextAniKind())
+ return;
- if(0.0 == fDelay)
- {
- // use default
- fDelay = 250.0;
- }
+ // get values
+ const SfxItemSet& rSet = GetObjectItemSet();
+ const sal_uInt32 nRepeat((sal_uInt32)rSet.Get(SDRATTR_TEXT_ANICOUNT).GetValue());
+ double fDelay((double)rSet.Get(SDRATTR_TEXT_ANIDELAY).GetValue());
- // prepare loop and add
- drawinglayer::animation::AnimationEntryLoop aLoop(nRepeat ? nRepeat : ENDLESS_LOOP);
- drawinglayer::animation::AnimationEntryFixed aStart(fDelay, 0.0);
- aLoop.append(aStart);
- drawinglayer::animation::AnimationEntryFixed aEnd(fDelay, 1.0);
- aLoop.append(aEnd);
- rAnimList.append(aLoop);
+ if(0.0 == fDelay)
+ {
+ // use default
+ fDelay = 250.0;
+ }
- // add stopped state if loop is not endless
- if(0L != nRepeat)
- {
- bool bVisibleWhenStopped(rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE).GetValue());
- drawinglayer::animation::AnimationEntryFixed aStop(ENDLESS_TIME, bVisibleWhenStopped ? 0.0 : 1.0);
- rAnimList.append(aStop);
- }
+ // prepare loop and add
+ drawinglayer::animation::AnimationEntryLoop aLoop(nRepeat ? nRepeat : ENDLESS_LOOP);
+ drawinglayer::animation::AnimationEntryFixed aStart(fDelay, 0.0);
+ aLoop.append(aStart);
+ drawinglayer::animation::AnimationEntryFixed aEnd(fDelay, 1.0);
+ aLoop.append(aEnd);
+ rAnimList.append(aLoop);
+
+ // add stopped state if loop is not endless
+ if(0L != nRepeat)
+ {
+ bool bVisibleWhenStopped(rSet.Get(SDRATTR_TEXT_ANISTOPINSIDE).GetValue());
+ drawinglayer::animation::AnimationEntryFixed aStop(ENDLESS_TIME, bVisibleWhenStopped ? 0.0 : 1.0);
+ rAnimList.append(aStop);
}
}
@@ -1368,67 +1368,67 @@ void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL
{
const SdrTextAniKind eAniKind(GetTextAniKind());
- if(SdrTextAniKind::Scroll == eAniKind || SdrTextAniKind::Alternate == eAniKind || SdrTextAniKind::Slide == eAniKind)
+ if(SdrTextAniKind::Scroll != eAniKind && SdrTextAniKind::Alternate != eAniKind && SdrTextAniKind::Slide != eAniKind)
+ return;
+
+ // get data. Goal is to calculate fTimeFullPath which is the time needed to
+ // move animation from (0.0) to (1.0) state
+ const SfxItemSet& rSet = GetObjectItemSet();
+ double fAnimationDelay((double)rSet.Get(SDRATTR_TEXT_ANIDELAY).GetValue());
+ double fSingleStepWidth((double)rSet.Get(SDRATTR_TEXT_ANIAMOUNT).GetValue());
+ const SdrTextAniDirection eDirection(GetTextAniDirection());
+ const bool bForward(SdrTextAniDirection::Right == eDirection || SdrTextAniDirection::Down == eDirection);
+
+ if(basegfx::fTools::equalZero(fAnimationDelay))
{
- // get data. Goal is to calculate fTimeFullPath which is the time needed to
- // move animation from (0.0) to (1.0) state
- const SfxItemSet& rSet = GetObjectItemSet();
- double fAnimationDelay((double)rSet.Get(SDRATTR_TEXT_ANIDELAY).GetValue());
- double fSingleStepWidth((double)rSet.Get(SDRATTR_TEXT_ANIAMOUNT).GetValue());
- const SdrTextAniDirection eDirection(GetTextAniDirection());
- const bool bForward(SdrTextAniDirection::Right == eDirection || SdrTextAniDirection::Down == eDirection);
-
- if(basegfx::fTools::equalZero(fAnimationDelay))
- {
- // default to 1/20 second
- fAnimationDelay = 50.0;
- }
+ // default to 1/20 second
+ fAnimationDelay = 50.0;
+ }
- if(basegfx::fTools::less(fSingleStepWidth, 0.0))
- {
- // data is in pixels, convert to logic. Imply PIXEL_DPI dpi.
- // It makes no sense to keep the view-transformation centered
- // definitions, so get rid of them here.
- fSingleStepWidth = (-fSingleStepWidth * (2540.0 / PIXEL_DPI));
- }
+ if(basegfx::fTools::less(fSingleStepWidth, 0.0))
+ {
+ // data is in pixels, convert to logic. Imply PIXEL_DPI dpi.
+ // It makes no sense to keep the view-transformation centered
+ // definitions, so get rid of them here.
+ fSingleStepWidth = (-fSingleStepWidth * (2540.0 / PIXEL_DPI));
+ }
- if(basegfx::fTools::equalZero(fSingleStepWidth))
- {
- // default to 1 millimeter
- fSingleStepWidth = 100.0;
- }
+ if(basegfx::fTools::equalZero(fSingleStepWidth))
+ {
+ // default to 1 millimeter
+ fSingleStepWidth = 100.0;
+ }
+
+ // use the length of the full animation path and the number of steps
+ // to get the full path time
+ const double fFullPathLength(fFrameLength + fTextLength);
+ const double fNumberOfSteps(fFullPathLength / fSingleStepWidth);
+ double fTimeFullPath(fNumberOfSteps * fAnimationDelay);
- // use the length of the full animation path and the number of steps
- // to get the full path time
- const double fFullPathLength(fFrameLength + fTextLength);
- const double fNumberOfSteps(fFullPathLength / fSingleStepWidth);
- double fTimeFullPath(fNumberOfSteps * fAnimationDelay);
+ if(fTimeFullPath < fAnimationDelay)
+ {
+ fTimeFullPath = fAnimationDelay;
+ }
- if(fTimeFullPath < fAnimationDelay)
+ switch(eAniKind)
+ {
+ case SdrTextAniKind::Scroll :
{
- fTimeFullPath = fAnimationDelay;
+ impCreateScrollTiming(rSet, rAnimList, bForward, fTimeFullPath, fAnimationDelay);
+ break;
}
-
- switch(eAniKind)
+ case SdrTextAniKind::Alternate :
{
- case SdrTextAniKind::Scroll :
- {
- impCreateScrollTiming(rSet, rAnimList, bForward, fTimeFullPath, fAnimationDelay);
- break;
- }
- case SdrTextAniKind::Alternate :
- {
- double fRelativeTextLength(fTextLength / (fFrameLength + fTextLength));
- impCreateAlternateTiming(rSet, rAnimList, fRelativeTextLength, bForward, fTimeFullPath, fAnimationDelay);
- break;
- }
- case SdrTextAniKind::Slide :
- {
- impCreateSlideTiming(rSet, rAnimList, bForward, fTimeFullPath, fAnimationDelay);
- break;
- }
- default : break; // SdrTextAniKind::NONE, SdrTextAniKind::Blink
+ double fRelativeTextLength(fTextLength / (fFrameLength + fTextLength));
+ impCreateAlternateTiming(rSet, rAnimList, fRelativeTextLength, bForward, fTimeFullPath, fAnimationDelay);
+ break;
+ }
+ case SdrTextAniKind::Slide :
+ {
+ impCreateSlideTiming(rSet, rAnimList, bForward, fTimeFullPath, fAnimationDelay);
+ break;
}
+ default : break; // SdrTextAniKind::NONE, SdrTextAniKind::Blink
}
}
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index 52a4dfa07ed2..96f0896c0b3a 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -345,24 +345,25 @@ EEAnchorMode SdrTextObj::GetOutlinerViewAnchorMode() const
void SdrTextObj::ImpSetTextEditParams() const
{
- if (pEdtOutl!=nullptr) {
- bool bUpdMerk=pEdtOutl->GetUpdateMode();
- if (bUpdMerk) pEdtOutl->SetUpdateMode(false);
- Size aPaperMin;
- Size aPaperMax;
- tools::Rectangle aEditArea;
- TakeTextEditArea(&aPaperMin,&aPaperMax,&aEditArea,nullptr);
- bool bContourFrame=IsContourTextFrame();
- pEdtOutl->SetMinAutoPaperSize(aPaperMin);
- pEdtOutl->SetMaxAutoPaperSize(aPaperMax);
- pEdtOutl->SetPaperSize(Size());
- if (bContourFrame) {
- tools::Rectangle aAnchorRect;
- TakeTextAnchorRect(aAnchorRect);
- ImpSetContourPolygon(*pEdtOutl,aAnchorRect, true);
- }
- if (bUpdMerk) pEdtOutl->SetUpdateMode(true);
+ if (pEdtOutl==nullptr)
+ return;
+
+ bool bUpdMerk=pEdtOutl->GetUpdateMode();
+ if (bUpdMerk) pEdtOutl->SetUpdateMode(false);
+ Size aPaperMin;
+ Size aPaperMax;
+ tools::Rectangle aEditArea;
+ TakeTextEditArea(&aPaperMin,&aPaperMax,&aEditArea,nullptr);
+ bool bContourFrame=IsContourTextFrame();
+ pEdtOutl->SetMinAutoPaperSize(aPaperMin);
+ pEdtOutl->SetMaxAutoPaperSize(aPaperMax);
+ pEdtOutl->SetPaperSize(Size());
+ if (bContourFrame) {
+ tools::Rectangle aAnchorRect;
+ TakeTextAnchorRect(aAnchorRect);
+ ImpSetContourPolygon(*pEdtOutl,aAnchorRect, true);
}
+ if (bUpdMerk) pEdtOutl->SetUpdateMode(true);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index eb6a7a972ca0..f121952d8992 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -328,27 +328,28 @@ void SdrObjList::impChildInserted(SdrObject const & rChild)
void SdrObjList::NbcInsertObject(SdrObject* pObj, size_t nPos)
{
DBG_ASSERT(pObj!=nullptr,"SdrObjList::NbcInsertObject(NULL)");
- if (pObj!=nullptr) {
- DBG_ASSERT(!pObj->IsInserted(),"The object already has the status Inserted.");
- const size_t nCount = GetObjCount();
- if (nPos>nCount) nPos=nCount;
- InsertObjectIntoContainer(*pObj,nPos);
+ if (pObj==nullptr)
+ return;
- if (nPos<nCount) bObjOrdNumsDirty=true;
- pObj->SetOrdNum(nPos);
- pObj->SetObjList(this);
- pObj->SetPage(pPage);
+ DBG_ASSERT(!pObj->IsInserted(),"The object already has the status Inserted.");
+ const size_t nCount = GetObjCount();
+ if (nPos>nCount) nPos=nCount;
+ InsertObjectIntoContainer(*pObj,nPos);
- // Inform the parent about change to allow invalidations at
- // evtl. existing parent visualisations
- impChildInserted(*pObj);
+ if (nPos<nCount) bObjOrdNumsDirty=true;
+ pObj->SetOrdNum(nPos);
+ pObj->SetObjList(this);
+ pObj->SetPage(pPage);
- if (!bRectsDirty) {
- aOutRect.Union(pObj->GetCurrentBoundRect());
- aSnapRect.Union(pObj->GetSnapRect());
- }
- pObj->SetInserted(true); // calls the UserCall (among others)
+ // Inform the parent about change to allow invalidations at
+ // evtl. existing parent visualisations
+ impChildInserted(*pObj);
+
+ if (!bRectsDirty) {
+ aOutRect.Union(pObj->GetCurrentBoundRect());
+ aSnapRect.Union(pObj->GetSnapRect());
}
+ pObj->SetInserted(true); // calls the UserCall (among others)
}
void SdrObjList::InsertObject(SdrObject* pObj, size_t nPos)
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index dbe359587664..764cd48aa212 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -422,178 +422,178 @@ void SdrPageView::DrawPageViewGrid(OutputDevice& rOut, const tools::Rectangle& r
if (ny1<0) ny1=-ny1;
if (ny2<0) ny2=-ny2;
- if (nx1!=0)
- {
- // no more global output size, use window size instead to decide grid sizes
- long nScreenWdt = rOut.GetOutputSizePixel().Width();
-
- long nMinDotPix=2;
- long nMinLinPix=4;
-
- if (nScreenWdt>=1600)
- {
- nMinDotPix=4;
- nMinLinPix=8;
- }
- else if (nScreenWdt>=1024)
- {
- nMinDotPix=3;
- nMinLinPix=6;
- }
- else
- { // e. g. 640x480
- nMinDotPix=2;
- nMinLinPix=4;
- }
- Size aMinDotDist(rOut.PixelToLogic(Size(nMinDotPix,nMinDotPix)));
- Size aMinLinDist(rOut.PixelToLogic(Size(nMinLinPix,nMinLinPix)));
- bool bHoriSolid=nx2<aMinDotDist.Width();
- bool bVertSolid=ny2<aMinDotDist.Height();
- // enlarge line offset (minimum 4 pixels)
- // enlarge by: *2 *5 *10 *20 *50 *100 ...
- int nTgl=0;
- long nVal0=nx1;
- while (nx1<aMinLinDist.Width())
- {
- long a=nx1;
+ if (nx1==0)
+ return;
- if (nTgl==0) nx1*=2;
- if (nTgl==1) nx1=nVal0*5; // => nx1*=2.5
- if (nTgl==2) nx1*=2;
+ // no more global output size, use window size instead to decide grid sizes
+ long nScreenWdt = rOut.GetOutputSizePixel().Width();
- nVal0=a;
- nTgl++; if (nTgl>=3) nTgl=0;
- }
- nTgl=0;
- nVal0=ny1;
- while (ny1<aMinLinDist.Height())
- {
- long a=ny1;
+ long nMinDotPix=2;
+ long nMinLinPix=4;
- if (nTgl==0) ny1*=2;
- if (nTgl==1) ny1=nVal0*5; // => ny1*=2.5
- if (nTgl==2) ny1*=2;
+ if (nScreenWdt>=1600)
+ {
+ nMinDotPix=4;
+ nMinLinPix=8;
+ }
+ else if (nScreenWdt>=1024)
+ {
+ nMinDotPix=3;
+ nMinLinPix=6;
+ }
+ else
+ { // e. g. 640x480
+ nMinDotPix=2;
+ nMinLinPix=4;
+ }
+ Size aMinDotDist(rOut.PixelToLogic(Size(nMinDotPix,nMinDotPix)));
+ Size aMinLinDist(rOut.PixelToLogic(Size(nMinLinPix,nMinLinPix)));
+ bool bHoriSolid=nx2<aMinDotDist.Width();
+ bool bVertSolid=ny2<aMinDotDist.Height();
+ // enlarge line offset (minimum 4 pixels)
+ // enlarge by: *2 *5 *10 *20 *50 *100 ...
+ int nTgl=0;
+ long nVal0=nx1;
+ while (nx1<aMinLinDist.Width())
+ {
+ long a=nx1;
- nVal0=a;
- nTgl++;
+ if (nTgl==0) nx1*=2;
+ if (nTgl==1) nx1=nVal0*5; // => nx1*=2.5
+ if (nTgl==2) nx1*=2;
- if (nTgl>=3) nTgl=0;
+ nVal0=a;
+ nTgl++; if (nTgl>=3) nTgl=0;
+ }
+ nTgl=0;
+ nVal0=ny1;
+ while (ny1<aMinLinDist.Height())
+ {
+ long a=ny1;
+
+ if (nTgl==0) ny1*=2;
+ if (nTgl==1) ny1=nVal0*5; // => ny1*=2.5
+ if (nTgl==2) ny1*=2;
+
+ nVal0=a;
+ nTgl++;
+
+ if (nTgl>=3) nTgl=0;
+ }
+
+ bool bHoriFine=nx2<nx1;
+ bool bVertFine=ny2<ny1;
+ bool bHoriLines=bHoriSolid || bHoriFine || !bVertFine;
+ bool bVertLines=bVertSolid || bVertFine;
+
+ Color aColorMerk( rOut.GetLineColor() );
+ rOut.SetLineColor( aColor );
+
+ bool bMap0=rOut.IsMapModeEnabled();
+
+ long nWrX=0;
+ long nWrY=0;
+ Point aOrg(aPgOrg);
+ long x1=GetPage()->GetLeftBorder()+1+nWrX;
+ long x2=GetPage()->GetWidth()-GetPage()->GetRightBorder()-1+nWrY;
+ long y1=GetPage()->GetUpperBorder()+1+nWrX;
+ long y2=GetPage()->GetHeight()-GetPage()->GetLowerBorder()-1+nWrY;
+ const SdrPageGridFrameList* pFrames=GetPage()->GetGridFrameList(this,nullptr);
+
+ sal_uInt16 nGridPaintCnt=1;
+ if (pFrames!=nullptr) nGridPaintCnt=pFrames->GetCount();
+ for (sal_uInt16 nGridPaintNum=0; nGridPaintNum<nGridPaintCnt; nGridPaintNum++) {
+ if (pFrames!=nullptr) {
+ const SdrPageGridFrame& rGF=(*pFrames)[nGridPaintNum];
+ nWrX=rGF.GetPaperRect().Left();
+ nWrY=rGF.GetPaperRect().Top();
+ x1=rGF.GetUserArea().Left();
+ x2=rGF.GetUserArea().Right();
+ y1=rGF.GetUserArea().Top();
+ y2=rGF.GetUserArea().Bottom();
+ aOrg=rGF.GetUserArea().TopLeft();
+ aOrg-=rGF.GetPaperRect().TopLeft();
+ }
+ if (!rRect.IsEmpty()) {
+ Size a1PixSiz(rOut.PixelToLogic(Size(1,1)));
+ long nX1Pix=a1PixSiz.Width(); // add 1 pixel of tolerance
+ long nY1Pix=a1PixSiz.Height();
+ if (x1<rRect.Left() -nX1Pix) x1=rRect.Left() -nX1Pix;
+ if (x2>rRect.Right() +nX1Pix) x2=rRect.Right() +nX1Pix;
+ if (y1<rRect.Top() -nY1Pix) y1=rRect.Top() -nY1Pix;
+ if (y2>rRect.Bottom()+nY1Pix) y2=rRect.Bottom()+nY1Pix;
}
- bool bHoriFine=nx2<nx1;
- bool bVertFine=ny2<ny1;
- bool bHoriLines=bHoriSolid || bHoriFine || !bVertFine;
- bool bVertLines=bVertSolid || bVertFine;
-
- Color aColorMerk( rOut.GetLineColor() );
- rOut.SetLineColor( aColor );
-
- bool bMap0=rOut.IsMapModeEnabled();
-
- long nWrX=0;
- long nWrY=0;
- Point aOrg(aPgOrg);
- long x1=GetPage()->GetLeftBorder()+1+nWrX;
- long x2=GetPage()->GetWidth()-GetPage()->GetRightBorder()-1+nWrY;
- long y1=GetPage()->GetUpperBorder()+1+nWrX;
- long y2=GetPage()->GetHeight()-GetPage()->GetLowerBorder()-1+nWrY;
- const SdrPageGridFrameList* pFrames=GetPage()->GetGridFrameList(this,nullptr);
-
- sal_uInt16 nGridPaintCnt=1;
- if (pFrames!=nullptr) nGridPaintCnt=pFrames->GetCount();
- for (sal_uInt16 nGridPaintNum=0; nGridPaintNum<nGridPaintCnt; nGridPaintNum++) {
- if (pFrames!=nullptr) {
- const SdrPageGridFrame& rGF=(*pFrames)[nGridPaintNum];
- nWrX=rGF.GetPaperRect().Left();
- nWrY=rGF.GetPaperRect().Top();
- x1=rGF.GetUserArea().Left();
- x2=rGF.GetUserArea().Right();
- y1=rGF.GetUserArea().Top();
- y2=rGF.GetUserArea().Bottom();
- aOrg=rGF.GetUserArea().TopLeft();
- aOrg-=rGF.GetPaperRect().TopLeft();
- }
- if (!rRect.IsEmpty()) {
- Size a1PixSiz(rOut.PixelToLogic(Size(1,1)));
- long nX1Pix=a1PixSiz.Width(); // add 1 pixel of tolerance
- long nY1Pix=a1PixSiz.Height();
- if (x1<rRect.Left() -nX1Pix) x1=rRect.Left() -nX1Pix;
- if (x2>rRect.Right() +nX1Pix) x2=rRect.Right() +nX1Pix;
- if (y1<rRect.Top() -nY1Pix) y1=rRect.Top() -nY1Pix;
- if (y2>rRect.Bottom()+nY1Pix) y2=rRect.Bottom()+nY1Pix;
- }
-
- long xBigOrg=aOrg.X()+nWrX;
- while (xBigOrg>=x1) xBigOrg-=nx1;
- while (xBigOrg<x1) xBigOrg+=nx1;
- long xFinOrg=xBigOrg;
- while (xFinOrg>=x1) xFinOrg-=nx2;
- while (xFinOrg<x1) xFinOrg+=nx2;
-
- long yBigOrg=aOrg.Y()+nWrY;
- while (yBigOrg>=y1) yBigOrg-=ny1;
- while (yBigOrg<y1) yBigOrg+=ny1;
- long yFinOrg=yBigOrg;
- while (yFinOrg>=y1) yFinOrg-=ny2;
- while (yFinOrg<y1) yFinOrg+=ny2;
-
- if( x1 <= x2 && y1 <= y2 )
+ long xBigOrg=aOrg.X()+nWrX;
+ while (xBigOrg>=x1) xBigOrg-=nx1;
+ while (xBigOrg<x1) xBigOrg+=nx1;
+ long xFinOrg=xBigOrg;
+ while (xFinOrg>=x1) xFinOrg-=nx2;
+ while (xFinOrg<x1) xFinOrg+=nx2;
+
+ long yBigOrg=aOrg.Y()+nWrY;
+ while (yBigOrg>=y1) yBigOrg-=ny1;
+ while (yBigOrg<y1) yBigOrg+=ny1;
+ long yFinOrg=yBigOrg;
+ while (yFinOrg>=y1) yFinOrg-=ny2;
+ while (yFinOrg<y1) yFinOrg+=ny2;
+
+ if( x1 <= x2 && y1 <= y2 )
+ {
+ if( bHoriLines )
{
- if( bHoriLines )
- {
- DrawGridFlags nGridFlags = ( bHoriSolid ? DrawGridFlags::HorzLines : DrawGridFlags::Dots );
- sal_uInt16 nSteps = sal_uInt16(nx1 / nx2);
- sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((nx1 * 1000L)/ nSteps) - (nx2 * 1000L) ) : 0;
- sal_uInt32 nStepOffset = 0;
- sal_uInt16 nPointOffset = 0;
+ DrawGridFlags nGridFlags = ( bHoriSolid ? DrawGridFlags::HorzLines : DrawGridFlags::Dots );
+ sal_uInt16 nSteps = sal_uInt16(nx1 / nx2);
+ sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((nx1 * 1000L)/ nSteps) - (nx2 * 1000L) ) : 0;
+ sal_uInt32 nStepOffset = 0;
+ sal_uInt16 nPointOffset = 0;
- for(sal_uInt16 a=0;a<nSteps;a++)
+ for(sal_uInt16 a=0;a<nSteps;a++)
+ {
+ // draw
+ rOut.DrawGrid(
+ tools::Rectangle( xFinOrg + (a * nx2) + nPointOffset, yBigOrg, x2, y2 ),
+ Size( nx1, ny1 ), nGridFlags );
+
+ // do a step
+ nStepOffset += nRestPerStepMul1000;
+ while(nStepOffset >= 1000)
{
- // draw
- rOut.DrawGrid(
- tools::Rectangle( xFinOrg + (a * nx2) + nPointOffset, yBigOrg, x2, y2 ),
- Size( nx1, ny1 ), nGridFlags );
-
- // do a step
- nStepOffset += nRestPerStepMul1000;
- while(nStepOffset >= 1000)
- {
- nStepOffset -= 1000;
- nPointOffset++;
- }
+ nStepOffset -= 1000;
+ nPointOffset++;
}
}
+ }
- if( bVertLines )
- {
- DrawGridFlags nGridFlags = ( bVertSolid ? DrawGridFlags::VertLines : DrawGridFlags::Dots );
- sal_uInt16 nSteps = sal_uInt16(ny1 / ny2);
- sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((ny1 * 1000L)/ nSteps) - (ny2 * 1000L) ) : 0;
- sal_uInt32 nStepOffset = 0;
- sal_uInt16 nPointOffset = 0;
+ if( bVertLines )
+ {
+ DrawGridFlags nGridFlags = ( bVertSolid ? DrawGridFlags::VertLines : DrawGridFlags::Dots );
+ sal_uInt16 nSteps = sal_uInt16(ny1 / ny2);
+ sal_uInt32 nRestPerStepMul1000 = nSteps ? ( ((ny1 * 1000L)/ nSteps) - (ny2 * 1000L) ) : 0;
+ sal_uInt32 nStepOffset = 0;
+ sal_uInt16 nPointOffset = 0;
- for(sal_uInt16 a=0;a<nSteps;a++)
+ for(sal_uInt16 a=0;a<nSteps;a++)
+ {
+ // draw
+ rOut.DrawGrid(
+ tools::Rectangle( xBigOrg, yFinOrg + (a * ny2) + nPointOffset, x2, y2 ),
+ Size( nx1, ny1 ), nGridFlags );
+
+ // do a step
+ nStepOffset += nRestPerStepMul1000;
+ while(nStepOffset >= 1000)
{
- // draw
- rOut.DrawGrid(
- tools::Rectangle( xBigOrg, yFinOrg + (a * ny2) + nPointOffset, x2, y2 ),
- Size( nx1, ny1 ), nGridFlags );
-
- // do a step
- nStepOffset += nRestPerStepMul1000;
- while(nStepOffset >= 1000)
- {
- nStepOffset -= 1000;
- nPointOffset++;
- }
+ nStepOffset -= 1000;
+ nPointOffset++;
}
}
}
}
-
- rOut.EnableMapMode(bMap0);
- rOut.SetLineColor(aColorMerk);
}
+
+ rOut.EnableMapMode(bMap0);
+ rOut.SetLineColor(aColorMerk);
}
void SdrPageView::AdjHdl()
@@ -814,39 +814,39 @@ bool SdrPageView::EnterGroup(SdrObject* pObj)
void SdrPageView::LeaveOneGroup()
{
- if(GetAktGroup())
- {
- bool bGlueInvalidate = GetView().ImpIsGlueVisible();
+ if(!GetAktGroup())
+ return;
- if(bGlueInvalidate)
- GetView().GlueInvalidate();
+ bool bGlueInvalidate = GetView().ImpIsGlueVisible();
- SdrObject* pLastGroup = GetAktGroup();
- SdrObject* pParentGroup = GetAktGroup()->GetUpGroup();
- SdrObjList* pParentList = GetPage();
+ if(bGlueInvalidate)
+ GetView().GlueInvalidate();
- if(pParentGroup)
- pParentList = pParentGroup->GetSubList();
+ SdrObject* pLastGroup = GetAktGroup();
+ SdrObject* pParentGroup = GetAktGroup()->GetUpGroup();
+ SdrObjList* pParentList = GetPage();
- // deselect everything
- GetView().UnmarkAll();
+ if(pParentGroup)
+ pParentList = pParentGroup->GetSubList();
- // allocations, pAktGroup and pAktList need to be set
- SetAktGroupAndList(pParentGroup, pParentList);
+ // deselect everything
+ GetView().UnmarkAll();
- // select the group we just left
- if(pLastGroup)
- if(GetView().GetSdrPageView())
- GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
+ // allocations, pAktGroup and pAktList need to be set
+ SetAktGroupAndList(pParentGroup, pParentList);
- GetView().AdjustMarkHdl();
+ // select the group we just left
+ if(pLastGroup)
+ if(GetView().GetSdrPageView())
+ GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
- // invalidate only if view wants to visualize group entering
- InvalidateAllWin();
+ GetView().AdjustMarkHdl();
- if(bGlueInvalidate)
- GetView().GlueInvalidate();
- }
+ // invalidate only if view wants to visualize group entering
+ InvalidateAllWin();
+
+ if(bGlueInvalidate)
+ GetView().GlueInvalidate();
}
void SdrPageView::LeaveAllGroup()
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 51174785edff..625578db868c 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -1127,47 +1127,47 @@ void SdrPaintView::MakeVisible(const tools::Rectangle& rRect, vcl::Window& rWin)
MapMode aMap(rWin.GetMapMode());
Size aActualSize(rWin.GetOutputSize());
- if( aActualSize.Height() > 0 && aActualSize.Width() > 0 )
+ if( aActualSize.Height() <= 0 || aActualSize.Width() <= 0 )
+ return;
+
+ Size aNewSize(rRect.GetSize());
+ bool bNewScale=false;
+ bool bNeedMoreX=aNewSize.Width()>aActualSize.Width();
+ bool bNeedMoreY=aNewSize.Height()>aActualSize.Height();
+ if (bNeedMoreX || bNeedMoreY)
{
- Size aNewSize(rRect.GetSize());
- bool bNewScale=false;
- bool bNeedMoreX=aNewSize.Width()>aActualSize.Width();
- bool bNeedMoreY=aNewSize.Height()>aActualSize.Height();
- if (bNeedMoreX || bNeedMoreY)
- {
- bNewScale=true;
- // set new MapMode (Size+Org) and invalidate everything
- Fraction aXFact(aNewSize.Width(),aActualSize.Width());
- Fraction aYFact(aNewSize.Height(),aActualSize.Height());
- if (aYFact>aXFact) aXFact=aYFact;
- aXFact*=aMap.GetScaleX();
- aXFact.ReduceInaccurate(10); // to avoid runovers and BigInt mapping
- aMap.SetScaleX(aXFact);
- aMap.SetScaleY(aYFact);
+ bNewScale=true;
+ // set new MapMode (Size+Org) and invalidate everything
+ Fraction aXFact(aNewSize.Width(),aActualSize.Width());
+ Fraction aYFact(aNewSize.Height(),aActualSize.Height());
+ if (aYFact>aXFact) aXFact=aYFact;
+ aXFact*=aMap.GetScaleX();
+ aXFact.ReduceInaccurate(10); // to avoid runovers and BigInt mapping
+ aMap.SetScaleX(aXFact);
+ aMap.SetScaleY(aYFact);
+ rWin.SetMapMode(aMap);
+ aActualSize=rWin.GetOutputSize();
+ }
+ Point aOrg(aMap.GetOrigin());
+ long dx=0,dy=0;
+ long l=-aOrg.X();
+ long r=-aOrg.X()+aActualSize.Width()-1;
+ long o=-aOrg.Y();
+ long u=-aOrg.Y()+aActualSize.Height()-1;
+ if (l>rRect.Left()) dx=rRect.Left()-l;
+ else if (r<rRect.Right()) dx=rRect.Right()-r;
+ if (o>rRect.Top()) dy=rRect.Top()-o;
+ else if (u<rRect.Bottom()) dy=rRect.Bottom()-u;
+ aMap.SetOrigin(Point(aOrg.X()-dx,aOrg.Y()-dy));
+ if (!bNewScale) {
+ if (dx!=0 || dy!=0) {
+ rWin.Scroll(-dx,-dy);
rWin.SetMapMode(aMap);
- aActualSize=rWin.GetOutputSize();
- }
- Point aOrg(aMap.GetOrigin());
- long dx=0,dy=0;
- long l=-aOrg.X();
- long r=-aOrg.X()+aActualSize.Width()-1;
- long o=-aOrg.Y();
- long u=-aOrg.Y()+aActualSize.Height()-1;
- if (l>rRect.Left()) dx=rRect.Left()-l;
- else if (r<rRect.Right()) dx=rRect.Right()-r;
- if (o>rRect.Top()) dy=rRect.Top()-o;
- else if (u<rRect.Bottom()) dy=rRect.Bottom()-u;
- aMap.SetOrigin(Point(aOrg.X()-dx,aOrg.Y()-dy));
- if (!bNewScale) {
- if (dx!=0 || dy!=0) {
- rWin.Scroll(-dx,-dy);
- rWin.SetMapMode(aMap);
- rWin.Update();
- }
- } else {
- rWin.SetMapMode(aMap);
- InvalidateOneWin(rWin);
+ rWin.Update();
}
+ } else {
+ rWin.SetMapMode(aMap);
+ InvalidateOneWin(rWin);
}
}
diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx
index 3e76f3fec202..1b7c81b037ec 100644
--- a/svx/source/svdraw/svdtext.cxx
+++ b/svx/source/svdraw/svdtext.cxx
@@ -126,48 +126,48 @@ void SdrText::SetModel( SdrModel* pNewModel )
SdrModel* pOldModel = mpModel;
mpModel = pNewModel;
- if( mpOutlinerParaObject && pOldModel!=nullptr && pNewModel!=nullptr)
+ if( !mpOutlinerParaObject || pOldModel==nullptr || pNewModel==nullptr)
+ return;
+
+ bool bHgtSet = GetObjectItemSet().GetItemState(EE_CHAR_FONTHEIGHT) == SfxItemState::SET;
+
+ MapUnit aOldUnit(pOldModel->GetScaleUnit());
+ MapUnit aNewUnit(pNewModel->GetScaleUnit());
+ bool bScaleUnitChanged=aNewUnit!=aOldUnit;
+ // Now move the OutlinerParaObject into a new Pool.
+ // TODO: We should compare the DefTab and RefDevice of both Models to
+ // see whether we need to use AutoGrow!
+ sal_uIntPtr nOldFontHgt=pOldModel->GetDefaultFontHeight();
+ sal_uIntPtr nNewFontHgt=pNewModel->GetDefaultFontHeight();
+ bool bDefHgtChanged=nNewFontHgt!=nOldFontHgt;
+ bool bSetHgtItem=bDefHgtChanged && !bHgtSet;
+ if (bSetHgtItem)
+ {
+ // fix the value of HeightItem, so
+ // 1. it remains and
+ // 2. DoStretchChars gets the right value
+ SetObjectItem(SvxFontHeightItem(nOldFontHgt, 100, EE_CHAR_FONTHEIGHT));
+ }
+ // now use the Outliner, etc. so the above SetAttr can work at all
+ SdrOutliner& rOutliner = mrObject.ImpGetDrawOutliner();
+ rOutliner.SetText(*mpOutlinerParaObject);
+ delete mpOutlinerParaObject;
+ mpOutlinerParaObject=nullptr;
+ if (bScaleUnitChanged)
{
- bool bHgtSet = GetObjectItemSet().GetItemState(EE_CHAR_FONTHEIGHT) == SfxItemState::SET;
-
- MapUnit aOldUnit(pOldModel->GetScaleUnit());
- MapUnit aNewUnit(pNewModel->GetScaleUnit());
- bool bScaleUnitChanged=aNewUnit!=aOldUnit;
- // Now move the OutlinerParaObject into a new Pool.
- // TODO: We should compare the DefTab and RefDevice of both Models to
- // see whether we need to use AutoGrow!
- sal_uIntPtr nOldFontHgt=pOldModel->GetDefaultFontHeight();
- sal_uIntPtr nNewFontHgt=pNewModel->GetDefaultFontHeight();
- bool bDefHgtChanged=nNewFontHgt!=nOldFontHgt;
- bool bSetHgtItem=bDefHgtChanged && !bHgtSet;
+ Fraction aMetricFactor=GetMapFactor(aOldUnit,aNewUnit).X();
+
if (bSetHgtItem)
{
- // fix the value of HeightItem, so
- // 1. it remains and
- // 2. DoStretchChars gets the right value
+ // Now correct the frame attribute
+ nOldFontHgt=BigMulDiv(nOldFontHgt,aMetricFactor.GetNumerator(),aMetricFactor.GetDenominator());
SetObjectItem(SvxFontHeightItem(nOldFontHgt, 100, EE_CHAR_FONTHEIGHT));
}
- // now use the Outliner, etc. so the above SetAttr can work at all
- SdrOutliner& rOutliner = mrObject.ImpGetDrawOutliner();
- rOutliner.SetText(*mpOutlinerParaObject);
- delete mpOutlinerParaObject;
- mpOutlinerParaObject=nullptr;
- if (bScaleUnitChanged)
- {
- Fraction aMetricFactor=GetMapFactor(aOldUnit,aNewUnit).X();
-
- if (bSetHgtItem)
- {
- // Now correct the frame attribute
- nOldFontHgt=BigMulDiv(nOldFontHgt,aMetricFactor.GetNumerator(),aMetricFactor.GetDenominator());
- SetObjectItem(SvxFontHeightItem(nOldFontHgt, 100, EE_CHAR_FONTHEIGHT));
- }
- }
- SetOutlinerParaObject(rOutliner.CreateParaObject());
- mpOutlinerParaObject->ClearPortionInfo();
- mbPortionInfoChecked=false;
- rOutliner.Clear();
}
+ SetOutlinerParaObject(rOutliner.CreateParaObject());
+ mpOutlinerParaObject->ClearPortionInfo();
+ mbPortionInfoChecked=false;
+ rOutliner.Clear();
}
void SdrText::ForceOutlinerParaObject( OutlinerMode nOutlMode )
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index bcbfa618ffcc..521ace14a873 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1164,58 +1164,58 @@ void SvxTableController::SetTableStyleSettings( const SfxItemSet* pArgs )
void SvxTableController::SetVertical( sal_uInt16 nSId )
{
SdrTableObj* pTableObj = dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() );
- if( mxTable.is() && pTableObj )
- {
- TableModelNotifyGuard aGuard( mxTable.get() );
+ if( !mxTable.is() || !pTableObj )
+ return;
- bool bUndo = mpModel && mpModel->IsUndoEnabled();
- if (bUndo)
- {
- mpModel->BegUndo(ImpGetResStr(STR_TABLE_NUMFORMAT));
- mpModel->AddUndo(mpModel->GetSdrUndoFactory().CreateUndoAttrObject(*pTableObj));
- }
+ TableModelNotifyGuard aGuard( mxTable.get() );
- CellPos aStart, aEnd;
- getSelectedCells( aStart, aEnd );
+ bool bUndo = mpModel && mpModel->IsUndoEnabled();
+ if (bUndo)
+ {
+ mpModel->BegUndo(ImpGetResStr(STR_TABLE_NUMFORMAT));
+ mpModel->AddUndo(mpModel->GetSdrUndoFactory().CreateUndoAttrObject(*pTableObj));
+ }
- SdrTextVertAdjust eAdj = SDRTEXTVERTADJUST_TOP;
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
- switch( nSId )
- {
- case SID_TABLE_VERT_BOTTOM:
- eAdj = SDRTEXTVERTADJUST_BOTTOM;
- break;
- case SID_TABLE_VERT_CENTER:
- eAdj = SDRTEXTVERTADJUST_CENTER;
- break;
- //case SID_TABLE_VERT_NONE:
- default:
- break;
- }
+ SdrTextVertAdjust eAdj = SDRTEXTVERTADJUST_TOP;
- SdrTextVertAdjustItem aItem( eAdj );
+ switch( nSId )
+ {
+ case SID_TABLE_VERT_BOTTOM:
+ eAdj = SDRTEXTVERTADJUST_BOTTOM;
+ break;
+ case SID_TABLE_VERT_CENTER:
+ eAdj = SDRTEXTVERTADJUST_CENTER;
+ break;
+ //case SID_TABLE_VERT_NONE:
+ default:
+ break;
+ }
- for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ SdrTextVertAdjustItem aItem( eAdj );
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
{
- for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
{
- CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
- if( xCell.is() )
- {
- if (bUndo)
- xCell->AddUndo();
- SfxItemSet aSet(xCell->GetItemSet());
- aSet.Put(aItem);
- xCell->SetMergedItemSetAndBroadcast(aSet, /*bClearAllItems=*/false);
- }
+ if (bUndo)
+ xCell->AddUndo();
+ SfxItemSet aSet(xCell->GetItemSet());
+ aSet.Put(aItem);
+ xCell->SetMergedItemSetAndBroadcast(aSet, /*bClearAllItems=*/false);
}
}
+ }
- UpdateTableShape();
+ UpdateTableShape();
- if (bUndo)
- mpModel->EndUndo();
- }
+ if (bUndo)
+ mpModel->EndUndo();
}
void SvxTableController::MergeMarkedCells()
@@ -2507,52 +2507,51 @@ void SvxTableController::UpdateTableShape()
void SvxTableController::SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll)
{
- if( mxTable.is() )
- {
- const bool bUndo = mpModel && mpModel->IsUndoEnabled();
+ if( !mxTable.is() )
+ return;
- if( bUndo )
- mpModel->BegUndo( ImpGetResStr(STR_TABLE_NUMFORMAT) );
+ const bool bUndo = mpModel && mpModel->IsUndoEnabled();
- CellPos aStart, aEnd;
- getSelectedCells( aStart, aEnd );
+ if( bUndo )
+ mpModel->BegUndo( ImpGetResStr(STR_TABLE_NUMFORMAT) );
- SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
- aAttr.Put(rAttr);
+ CellPos aStart, aEnd;
+ getSelectedCells( aStart, aEnd );
- const bool bFrame = (rAttr.GetItemState( SDRATTR_TABLE_BORDER ) == SfxItemState::SET) || (rAttr.GetItemState( SDRATTR_TABLE_BORDER_INNER ) == SfxItemState::SET);
+ SfxItemSet aAttr(*rAttr.GetPool(), rAttr.GetRanges());
+ aAttr.Put(rAttr);
- if( bFrame )
- {
- aAttr.ClearItem( SDRATTR_TABLE_BORDER );
- aAttr.ClearItem( SDRATTR_TABLE_BORDER_INNER );
- }
+ const bool bFrame = (rAttr.GetItemState( SDRATTR_TABLE_BORDER ) == SfxItemState::SET) || (rAttr.GetItemState( SDRATTR_TABLE_BORDER_INNER ) == SfxItemState::SET);
- for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ if( bFrame )
+ {
+ aAttr.ClearItem( SDRATTR_TABLE_BORDER );
+ aAttr.ClearItem( SDRATTR_TABLE_BORDER_INNER );
+ }
+
+ for( sal_Int32 nRow = aStart.mnRow; nRow <= aEnd.mnRow; nRow++ )
+ {
+ for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
{
- for( sal_Int32 nCol = aStart.mnCol; nCol <= aEnd.mnCol; nCol++ )
+ CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
+ if( xCell.is() )
{
- CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) );
- if( xCell.is() )
- {
- if( bUndo )
- xCell->AddUndo();
- xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
- }
+ if( bUndo )
+ xCell->AddUndo();
+ xCell->SetMergedItemSetAndBroadcast(aAttr, bReplaceAll);
}
}
+ }
- if( bFrame )
- {
- ApplyBorderAttr( rAttr );
- }
-
- UpdateTableShape();
+ if( bFrame )
+ {
+ ApplyBorderAttr( rAttr );
+ }
- if( bUndo )
- mpModel->EndUndo();
+ UpdateTableShape();
- }
+ if( bUndo )
+ mpModel->EndUndo();
}
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index feff4152a52d..6571d3086eb3 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -259,29 +259,29 @@ void SvxColorDockingWindow::Notify( SfxBroadcaster& , const SfxHint& rHint )
void SvxColorDockingWindow::FillValueSet()
{
- if( pColorList.is() )
- {
- nCount = pColorList->Count();
- aColorSet->Clear();
+ if( !pColorList.is() )
+ return;
- // create the first entry for 'invisible/none'
- const Size aColorSize(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength());
- long nPtX = aColorSize.Width() - 1;
- long nPtY = aColorSize.Height() - 1;
- ScopedVclPtrInstance< VirtualDevice > pVD;
+ nCount = pColorList->Count();
+ aColorSet->Clear();
- pVD->SetOutputSizePixel( aColorSize );
- pVD->SetLineColor( Color( COL_BLACK ) );
- pVD->SetBackground( Wallpaper( Color( COL_WHITE ) ) );
- pVD->DrawLine( Point(), Point( nPtX, nPtY ) );
- pVD->DrawLine( Point( 0, nPtY ), Point( nPtX, 0 ) );
+ // create the first entry for 'invisible/none'
+ const Size aColorSize(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength());
+ long nPtX = aColorSize.Width() - 1;
+ long nPtY = aColorSize.Height() - 1;
+ ScopedVclPtrInstance< VirtualDevice > pVD;
- Bitmap aBmp( pVD->GetBitmap( Point(), aColorSize ) );
+ pVD->SetOutputSizePixel( aColorSize );
+ pVD->SetLineColor( Color( COL_BLACK ) );
+ pVD->SetBackground( Wallpaper( Color( COL_WHITE ) ) );
+ pVD->DrawLine( Point(), Point( nPtX, nPtY ) );
+ pVD->DrawLine( Point( 0, nPtY ), Point( nPtX, 0 ) );
- aColorSet->InsertItem( (sal_uInt16)1, Image(aBmp), SvxResId( RID_SVXSTR_INVISIBLE ) );
+ Bitmap aBmp( pVD->GetBitmap( Point(), aColorSize ) );
- aColorSet->addEntriesForXColorList(*pColorList, 2);
- }
+ aColorSet->InsertItem( (sal_uInt16)1, Image(aBmp), SvxResId( RID_SVXSTR_INVISIBLE ) );
+
+ aColorSet->addEntriesForXColorList(*pColorList, 2);
}
void SvxColorDockingWindow::SetSize()
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 2bc48400da49..75feaa728cff 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -84,62 +84,62 @@ void SvxLineBox::Select()
// Call the parent's Select() member to trigger accessibility events.
LineLB::Select();
- if ( !IsTravelSelect() )
+ if ( IsTravelSelect() )
+ return;
+
+ drawing::LineStyle eXLS;
+ sal_Int32 nPos = GetSelectedEntryPos();
+
+ switch ( nPos )
{
- drawing::LineStyle eXLS;
- sal_Int32 nPos = GetSelectedEntryPos();
+ case 0:
+ eXLS = drawing::LineStyle_NONE;
+ break;
- switch ( nPos )
- {
- case 0:
- eXLS = drawing::LineStyle_NONE;
- break;
+ case 1:
+ eXLS = drawing::LineStyle_SOLID;
+ break;
- case 1:
- eXLS = drawing::LineStyle_SOLID;
- break;
+ default:
+ {
+ eXLS = drawing::LineStyle_DASH;
- default:
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND &&
+ SfxObjectShell::Current() &&
+ SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) )
{
- eXLS = drawing::LineStyle_DASH;
-
- if ( nPos != LISTBOX_ENTRY_NOTFOUND &&
- SfxObjectShell::Current() &&
- SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) )
- {
- // LineDashItem will only be sent if it also has a dash.
- // Notify cares!
- SvxDashListItem aItem( *static_cast<const SvxDashListItem*>(
- SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) ) );
- XLineDashItem aLineDashItem( GetSelectedEntry(),
- aItem.GetDashList()->GetDash( nPos - 2 )->GetDash() );
-
- Any a;
- Sequence< PropertyValue > aArgs( 1 );
- aArgs[0].Name = "LineDash";
- aLineDashItem.QueryValue ( a );
- aArgs[0].Value = a;
- SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
- ".uno:LineDash",
- aArgs );
- }
+ // LineDashItem will only be sent if it also has a dash.
+ // Notify cares!
+ SvxDashListItem aItem( *static_cast<const SvxDashListItem*>(
+ SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) ) );
+ XLineDashItem aLineDashItem( GetSelectedEntry(),
+ aItem.GetDashList()->GetDash( nPos - 2 )->GetDash() );
+
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = "LineDash";
+ aLineDashItem.QueryValue ( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ ".uno:LineDash",
+ aArgs );
}
- break;
}
+ break;
+ }
- XLineStyleItem aLineStyleItem( eXLS );
- Any a;
- Sequence< PropertyValue > aArgs( 1 );
- aArgs[0].Name = "XLineStyle";
- aLineStyleItem.QueryValue ( a );
- aArgs[0].Value = a;
- SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
- ".uno:XLineStyle",
- aArgs );
+ XLineStyleItem aLineStyleItem( eXLS );
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = "XLineStyle";
+ aLineStyleItem.QueryValue ( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+ ".uno:XLineStyle",
+ aArgs );
- nCurPos = GetSelectedEntryPos();
- ReleaseFocus_Impl();
- }
+ nCurPos = GetSelectedEntryPos();
+ ReleaseFocus_Impl();
}
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 157dca24d298..3b460fb8ec09 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -275,43 +275,43 @@ void TableWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang
}
// the text near the mouse cursor telling the table dimensions
- if (nCol && nLine)
+ if (!nCol || !nLine)
+ return;
+
+ OUString aText;
+ aText += OUString::number( nCol );
+ aText += " x ";
+ aText += OUString::number( nLine );
+ if(GetId() == FN_SHOW_MULTIPLE_PAGES)
{
- OUString aText;
- aText += OUString::number( nCol );
- aText += " x ";
- aText += OUString::number( nLine );
- if(GetId() == FN_SHOW_MULTIPLE_PAGES)
- {
- aText += " ";
- aText += SvxResId(RID_SVXSTR_PAGES);
- }
+ aText += " ";
+ aText += SvxResId(RID_SVXSTR_PAGES);
+ }
- Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight());
+ Size aTextSize(rRenderContext.GetTextWidth(aText), rRenderContext.GetTextHeight());
- long nTextX = nSelectionWidth + mnTableCellWidth;
- long nTextY = nSelectionHeight + mnTableCellHeight;
- const long nTipBorder = 2;
+ long nTextX = nSelectionWidth + mnTableCellWidth;
+ long nTextY = nSelectionHeight + mnTableCellHeight;
+ const long nTipBorder = 2;
- if (aTextSize.Width() + mnTablePosX + mnTableCellWidth + 2 * nTipBorder < nSelectionWidth)
- nTextX = nSelectionWidth - mnTableCellWidth - aTextSize.Width();
+ if (aTextSize.Width() + mnTablePosX + mnTableCellWidth + 2 * nTipBorder < nSelectionWidth)
+ nTextX = nSelectionWidth - mnTableCellWidth - aTextSize.Width();
- if (aTextSize.Height() + mnTablePosY + mnTableCellHeight + 2 * nTipBorder < nSelectionHeight)
- nTextY = nSelectionHeight - mnTableCellHeight - aTextSize.Height();
+ if (aTextSize.Height() + mnTablePosY + mnTableCellHeight + 2 * nTipBorder < nSelectionHeight)
+ nTextY = nSelectionHeight - mnTableCellHeight - aTextSize.Height();
- rRenderContext.SetLineColor(aLineColor);
- rRenderContext.SetFillColor(aBackgroundColor);
- rRenderContext.DrawRect(tools::Rectangle(nTextX - 2 * nTipBorder,
- nTextY - 2 * nTipBorder,
- nTextX + aTextSize.Width() + nTipBorder,
- nTextY + aTextSize.Height() + nTipBorder));
+ rRenderContext.SetLineColor(aLineColor);
+ rRenderContext.SetFillColor(aBackgroundColor);
+ rRenderContext.DrawRect(tools::Rectangle(nTextX - 2 * nTipBorder,
+ nTextY - 2 * nTipBorder,
+ nTextX + aTextSize.Width() + nTipBorder,
+ nTextY + aTextSize.Height() + nTipBorder));
- // #i95350# force RTL output
- if (IsRTLEnabled())
- aText = OUStringLiteral1(0x202D) + aText;
+ // #i95350# force RTL output
+ if (IsRTLEnabled())
+ aText = OUStringLiteral1(0x202D) + aText;
- rRenderContext.DrawText(Point(nTextX, nTextY), aText);
- }
+ rRenderContext.DrawText(Point(nTextX, nTextY), aText);
}
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 987796504f43..b9e7b5e222dc 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -366,50 +366,50 @@ IMPL_LINK_NOARG(SvxLineEndWindow, SelectHdl, ValueSet*, void)
void SvxLineEndWindow::FillValueSet()
{
- if( mpLineEndList.is() )
- {
- ScopedVclPtrInstance< VirtualDevice > pVD;
+ if( !mpLineEndList.is() )
+ return;
- long nCount = mpLineEndList->Count();
+ ScopedVclPtrInstance< VirtualDevice > pVD;
- // First entry: no line end.
- // An entry is temporarily added to get the UI bitmap
- basegfx::B2DPolyPolygon aNothing;
- mpLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aNothing, SvxResId(RID_SVXSTR_NONE)));
- const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(nCount);
- Bitmap aBmp = mpLineEndList->GetUiBitmap( nCount );
- OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
+ long nCount = mpLineEndList->Count();
- maBmpSize = aBmp.GetSizePixel();
- pVD->SetOutputSizePixel( maBmpSize, false );
- maBmpSize.Width() = maBmpSize.Width() / 2;
- Point aPt0( 0, 0 );
- Point aPt1( maBmpSize.Width(), 0 );
+ // First entry: no line end.
+ // An entry is temporarily added to get the UI bitmap
+ basegfx::B2DPolyPolygon aNothing;
+ mpLineEndList->Insert(o3tl::make_unique<XLineEndEntry>(aNothing, SvxResId(RID_SVXSTR_NONE)));
+ const XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(nCount);
+ Bitmap aBmp = mpLineEndList->GetUiBitmap( nCount );
+ OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
- pVD->DrawBitmap( Point(), aBmp );
- mpLineEndSet->InsertItem(1, Image(pVD->GetBitmap(aPt0, maBmpSize)), pEntry->GetName());
- mpLineEndSet->InsertItem(2, Image(pVD->GetBitmap(aPt1, maBmpSize)), pEntry->GetName());
+ maBmpSize = aBmp.GetSizePixel();
+ pVD->SetOutputSizePixel( maBmpSize, false );
+ maBmpSize.Width() = maBmpSize.Width() / 2;
+ Point aPt0( 0, 0 );
+ Point aPt1( maBmpSize.Width(), 0 );
- mpLineEndList->Remove(nCount);
+ pVD->DrawBitmap( Point(), aBmp );
+ mpLineEndSet->InsertItem(1, Image(pVD->GetBitmap(aPt0, maBmpSize)), pEntry->GetName());
+ mpLineEndSet->InsertItem(2, Image(pVD->GetBitmap(aPt1, maBmpSize)), pEntry->GetName());
- for( long i = 0; i < nCount; i++ )
- {
- pEntry = mpLineEndList->GetLineEnd( i );
- DBG_ASSERT( pEntry, "Could not access LineEndEntry" );
- aBmp = mpLineEndList->GetUiBitmap( i );
- OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
-
- pVD->DrawBitmap( aPt0, aBmp );
- mpLineEndSet->InsertItem((sal_uInt16)((i+1)*2L+1),
- Image(pVD->GetBitmap(aPt0, maBmpSize)), pEntry->GetName());
- mpLineEndSet->InsertItem((sal_uInt16)((i+2)*2L),
- Image(pVD->GetBitmap(aPt1, maBmpSize)), pEntry->GetName());
- }
- mnLines = std::min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES );
- mpLineEndSet->SetLineCount( mnLines );
+ mpLineEndList->Remove(nCount);
- SetSize();
+ for( long i = 0; i < nCount; i++ )
+ {
+ pEntry = mpLineEndList->GetLineEnd( i );
+ DBG_ASSERT( pEntry, "Could not access LineEndEntry" );
+ aBmp = mpLineEndList->GetUiBitmap( i );
+ OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" );
+
+ pVD->DrawBitmap( aPt0, aBmp );
+ mpLineEndSet->InsertItem((sal_uInt16)((i+1)*2L+1),
+ Image(pVD->GetBitmap(aPt0, maBmpSize)), pEntry->GetName());
+ mpLineEndSet->InsertItem((sal_uInt16)((i+2)*2L),
+ Image(pVD->GetBitmap(aPt1, maBmpSize)), pEntry->GetName());
}
+ mnLines = std::min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES );
+ mpLineEndSet->SetLineCount( mnLines );
+
+ SetSize();
}
void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent )
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index ceb6b4af4b77..efd6c4861f4e 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -432,82 +432,82 @@ void SvxStyleBox_Impl::Select()
// Tell base class about selection so that AT get informed about it.
ComboBox::Select();
- if ( !IsTravelSelect() )
+ if ( IsTravelSelect() )
+ return;
+
+ OUString aSearchEntry( GetText() );
+ bool bDoIt = true, bClear = false;
+ if( bInSpecialMode )
{
- OUString aSearchEntry( GetText() );
- bool bDoIt = true, bClear = false;
- if( bInSpecialMode )
+ if( aSearchEntry == aClearFormatKey && GetSelectedEntryPos() == 0 )
{
- if( aSearchEntry == aClearFormatKey && GetSelectedEntryPos() == 0 )
- {
- aSearchEntry = sDefaultStyle;
- bClear = true;
- //not only apply default style but also call 'ClearFormatting'
- Sequence< PropertyValue > aEmptyVals;
- SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:ResetAttributes",
- aEmptyVals);
- }
- else if( aSearchEntry == aMoreKey && GetSelectedEntryPos() == ( GetEntryCount() - 1 ) )
- {
- SfxViewFrame* pViewFrm = SfxViewFrame::Current();
- DBG_ASSERT( pViewFrm, "SvxStyleBox_Impl::Select(): no viewframe" );
- pViewFrm->ShowChildWindow( SID_SIDEBAR );
- ::sfx2::sidebar::Sidebar::ShowPanel("StyleListPanel",
- pViewFrm->GetFrame().GetFrameInterface());
- //tdf#113214 change text back to previous entry
- SetText(GetSavedValue());
- bDoIt = false;
- }
+ aSearchEntry = sDefaultStyle;
+ bClear = true;
+ //not only apply default style but also call 'ClearFormatting'
+ Sequence< PropertyValue > aEmptyVals;
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:ResetAttributes",
+ aEmptyVals);
}
+ else if( aSearchEntry == aMoreKey && GetSelectedEntryPos() == ( GetEntryCount() - 1 ) )
+ {
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ DBG_ASSERT( pViewFrm, "SvxStyleBox_Impl::Select(): no viewframe" );
+ pViewFrm->ShowChildWindow( SID_SIDEBAR );
+ ::sfx2::sidebar::Sidebar::ShowPanel("StyleListPanel",
+ pViewFrm->GetFrame().GetFrameInterface());
+ //tdf#113214 change text back to previous entry
+ SetText(GetSavedValue());
+ bDoIt = false;
+ }
+ }
- //Do we need to create a new style?
- SfxObjectShell *pShell = SfxObjectShell::Current();
- SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
- SfxStyleSheetBase* pStyle = nullptr;
+ //Do we need to create a new style?
+ SfxObjectShell *pShell = SfxObjectShell::Current();
+ SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
+ SfxStyleSheetBase* pStyle = nullptr;
- bool bCreateNew = false;
+ bool bCreateNew = false;
- if ( pPool )
- {
- pPool->SetSearchMask( eStyleFamily );
+ if ( pPool )
+ {
+ pPool->SetSearchMask( eStyleFamily );
- pStyle = pPool->First();
- while ( pStyle && pStyle->GetName() != aSearchEntry )
- pStyle = pPool->Next();
- }
+ pStyle = pPool->First();
+ while ( pStyle && pStyle->GetName() != aSearchEntry )
+ pStyle = pPool->Next();
+ }
- if ( !pStyle )
- {
- // cannot find the style for whatever reason
- // therefore create a new style
- bCreateNew = true;
- }
+ if ( !pStyle )
+ {
+ // cannot find the style for whatever reason
+ // therefore create a new style
+ bCreateNew = true;
+ }
+
+ /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
+ This instance may be deleted in the meantime (i.e. when a dialog is opened
+ while in Dispatch()), accessing members will crash in this case. */
+ ReleaseFocus();
- /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
- This instance may be deleted in the meantime (i.e. when a dialog is opened
- while in Dispatch()), accessing members will crash in this case. */
- ReleaseFocus();
+ if( bDoIt )
+ {
+ if ( bClear )
+ SetText( aSearchEntry );
+ SaveValue();
- if( bDoIt )
+ Sequence< PropertyValue > aArgs( 2 );
+ aArgs[0].Value <<= aSearchEntry;
+ aArgs[1].Name = "Family";
+ aArgs[1].Value <<= sal_Int16( eStyleFamily );
+ if( bCreateNew )
{
- if ( bClear )
- SetText( aSearchEntry );
- SaveValue();
-
- Sequence< PropertyValue > aArgs( 2 );
- aArgs[0].Value <<= aSearchEntry;
- aArgs[1].Name = "Family";
- aArgs[1].Value <<= sal_Int16( eStyleFamily );
- if( bCreateNew )
- {
- aArgs[0].Name = "Param";
- SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:StyleNewByExample", aArgs);
- }
- else
- {
- aArgs[0].Name = "Template";
- SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs );
- }
+ aArgs[0].Name = "Param";
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:StyleNewByExample", aArgs);
+ }
+ else
+ {
+ aArgs[0].Name = "Template";
+ SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs );
}
}
}
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 2e51c1afbc2c..e2c38217e393 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -1401,52 +1401,52 @@ css::uno::Sequence < css::uno::Reference< css::frame::XDispatch > > SAL_CALL Fin
void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css::uno::Sequence < css::beans::PropertyValue >& /*lArgs*/ )
{
//vnd.sun.star.findbar:FocusToFindbar - set cursor to the FindTextFieldControl of the findbar
- if ( aURL.Path == "FocusToFindbar" )
- {
- css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY);
- if(!xPropSet.is())
- return;
+ if ( aURL.Path != "FocusToFindbar" )
+ return;
- css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
- css::uno::Any aValue = xPropSet->getPropertyValue("LayoutManager");
- aValue >>= xLayoutManager;
- if (!xLayoutManager.is())
- return;
+ css::uno::Reference< css::beans::XPropertySet > xPropSet(m_xFrame, css::uno::UNO_QUERY);
+ if(!xPropSet.is())
+ return;
- const OUString sResourceURL( "private:resource/toolbar/findbar" );
- css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL);
- if (!xUIElement.is())
- {
- // show the findbar if necessary
- xLayoutManager->createElement( sResourceURL );
- xLayoutManager->showElement( sResourceURL );
- xUIElement = xLayoutManager->getElement( sResourceURL );
- if ( !xUIElement.is() )
- return;
- }
+ css::uno::Reference< css::frame::XLayoutManager > xLayoutManager;
+ css::uno::Any aValue = xPropSet->getPropertyValue("LayoutManager");
+ aValue >>= xLayoutManager;
+ if (!xLayoutManager.is())
+ return;
- css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
- ToolBox* pToolBox = static_cast<ToolBox*>(pWindow.get());
- if ( pToolBox )
+ const OUString sResourceURL( "private:resource/toolbar/findbar" );
+ css::uno::Reference< css::ui::XUIElement > xUIElement = xLayoutManager->getElement(sResourceURL);
+ if (!xUIElement.is())
+ {
+ // show the findbar if necessary
+ xLayoutManager->createElement( sResourceURL );
+ xLayoutManager->showElement( sResourceURL );
+ xUIElement = xLayoutManager->getElement( sResourceURL );
+ if ( !xUIElement.is() )
+ return;
+ }
+
+ css::uno::Reference< css::awt::XWindow > xWindow(xUIElement->getRealInterface(), css::uno::UNO_QUERY);
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ ToolBox* pToolBox = static_cast<ToolBox*>(pWindow.get());
+ if ( pToolBox )
+ {
+ ToolBox::ImplToolItems::size_type nItemCount = pToolBox->GetItemCount();
+ for ( ToolBox::ImplToolItems::size_type i=0; i<nItemCount; ++i )
{
- ToolBox::ImplToolItems::size_type nItemCount = pToolBox->GetItemCount();
- for ( ToolBox::ImplToolItems::size_type i=0; i<nItemCount; ++i )
+ sal_uInt16 id = pToolBox->GetItemId(i);
+ OUString sItemCommand = pToolBox->GetItemCommand(id);
+ if ( sItemCommand == COMMAND_FINDTEXT )
{
- sal_uInt16 id = pToolBox->GetItemId(i);
- OUString sItemCommand = pToolBox->GetItemCommand(id);
- if ( sItemCommand == COMMAND_FINDTEXT )
+ vcl::Window* pItemWin = pToolBox->GetItemWindow( id );
+ if ( pItemWin )
{
- vcl::Window* pItemWin = pToolBox->GetItemWindow( id );
- if ( pItemWin )
- {
- SolarMutexGuard aSolarMutexGuard;
- FindTextFieldControl* pFindTextFieldControl = dynamic_cast<FindTextFieldControl*>(pItemWin);
- if ( pFindTextFieldControl )
- pFindTextFieldControl->SetTextToSelected_Impl();
- pItemWin->GrabFocus();
- return;
- }
+ SolarMutexGuard aSolarMutexGuard;
+ FindTextFieldControl* pFindTextFieldControl = dynamic_cast<FindTextFieldControl*>(pItemWin);
+ if ( pFindTextFieldControl )
+ pFindTextFieldControl->SetTextToSelected_Impl();
+ pItemWin->GrabFocus();
+ return;
}
}
}
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 698f334de723..974834034de3 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -80,105 +80,105 @@ namespace svx
if (aColor.GetColor() == COL_AUTO)
aColor = Color(COL_TRANSPARENT);
- if ((maCurColor != aColor) || bSizeChanged || bDisplayModeChanged || bForceUpdate)
+ if ((maCurColor == aColor) && !bSizeChanged && !bDisplayModeChanged && !bForceUpdate)
+ return;
+
+ // create an empty bitmap, and copy the original bitmap inside
+ // (so that it grows in case the original bitmap was smaller)
+ sal_uInt8 nAlpha = 255;
+ BitmapEx aBmpEx(Bitmap(aItemSize, 24), AlphaMask(aItemSize, &nAlpha));
+
+ BitmapEx aSource(aImage.GetBitmapEx());
+ long nWidth = std::min(aItemSize.Width(), aSource.GetSizePixel().Width());
+ long nHeight = std::min(aItemSize.Height(), aSource.GetSizePixel().Height());
+
+ tools::Rectangle aRect(Point(0, 0), Size(nWidth, nHeight));
+
+ aBmpEx.CopyPixel( aRect, aRect, &aSource );
+
+ Bitmap aBmp( aBmpEx.GetBitmap() );
+ BitmapWriteAccess* pBmpAcc = aBmp.IsEmpty() ? nullptr : aBmp.AcquireWriteAccess();
+
+ maBmpSize = aBmp.GetSizePixel();
+
+ if (!pBmpAcc)
+ return;
+
+ Bitmap aMsk;
+ BitmapWriteAccess* pMskAcc;
+
+ if (aBmpEx.IsAlpha())
+ {
+ aMsk = aBmpEx.GetAlpha().GetBitmap();
+ pMskAcc = aMsk.AcquireWriteAccess();
+ }
+ else if (aBmpEx.IsTransparent())
+ {
+ aMsk = aBmpEx.GetMask();
+ pMskAcc = aMsk.AcquireWriteAccess();
+ }
+ else
{
- // create an empty bitmap, and copy the original bitmap inside
- // (so that it grows in case the original bitmap was smaller)
- sal_uInt8 nAlpha = 255;
- BitmapEx aBmpEx(Bitmap(aItemSize, 24), AlphaMask(aItemSize, &nAlpha));
+ pMskAcc = nullptr;
+ }
+
+ mbWasHiContrastMode = mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode();
- BitmapEx aSource(aImage.GetBitmapEx());
- long nWidth = std::min(aItemSize.Width(), aSource.GetSizePixel().Width());
- long nHeight = std::min(aItemSize.Height(), aSource.GetSizePixel().Height());
+ if ((COL_TRANSPARENT != aColor.GetColor()) && (maBmpSize.Width() == maBmpSize.Height()))
+ pBmpAcc->SetLineColor(aColor);
+ else if( mpTbx->GetBackground().GetColor().IsDark() )
+ pBmpAcc->SetLineColor(Color(COL_WHITE));
+ else
+ pBmpAcc->SetLineColor(Color(COL_BLACK));
- tools::Rectangle aRect(Point(0, 0), Size(nWidth, nHeight));
+ // use not only COL_TRANSPARENT for detection of transparence,
+ // but the method/way which is designed to do that
+ const bool bIsTransparent(0xff == aColor.GetTransparency());
+ maCurColor = aColor;
- aBmpEx.CopyPixel( aRect, aRect, &aSource );
+ if (bIsTransparent)
+ {
+ pBmpAcc->SetFillColor();
+ }
+ else
+ {
+ pBmpAcc->SetFillColor(maCurColor);
+ }
- Bitmap aBmp( aBmpEx.GetBitmap() );
- BitmapWriteAccess* pBmpAcc = aBmp.IsEmpty() ? nullptr : aBmp.AcquireWriteAccess();
+ if (maBmpSize.Width() == maBmpSize.Height())
+ // tdf#84985 align color bar with icon bottom edge; integer arithmetic e.g. 26 - 26/4 <> 26 * 3/4
+ maUpdRect = tools::Rectangle(Point( 0, maBmpSize.Height() - maBmpSize.Height() / 4), Size(maBmpSize.Width(), maBmpSize.Height() / 4));
+ else
+ maUpdRect = tools::Rectangle(Point( maBmpSize.Height() + 2, 2), Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3));
- maBmpSize = aBmp.GetSizePixel();
+ pBmpAcc->DrawRect(maUpdRect);
- if (pBmpAcc)
+ if (pMskAcc)
+ {
+ if (bIsTransparent)
{
- Bitmap aMsk;
- BitmapWriteAccess* pMskAcc;
-
- if (aBmpEx.IsAlpha())
- {
- aMsk = aBmpEx.GetAlpha().GetBitmap();
- pMskAcc = aMsk.AcquireWriteAccess();
- }
- else if (aBmpEx.IsTransparent())
- {
- aMsk = aBmpEx.GetMask();
- pMskAcc = aMsk.AcquireWriteAccess();
- }
- else
- {
- pMskAcc = nullptr;
- }
-
- mbWasHiContrastMode = mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode();
-
- if ((COL_TRANSPARENT != aColor.GetColor()) && (maBmpSize.Width() == maBmpSize.Height()))
- pBmpAcc->SetLineColor(aColor);
- else if( mpTbx->GetBackground().GetColor().IsDark() )
- pBmpAcc->SetLineColor(Color(COL_WHITE));
- else
- pBmpAcc->SetLineColor(Color(COL_BLACK));
-
- // use not only COL_TRANSPARENT for detection of transparence,
- // but the method/way which is designed to do that
- const bool bIsTransparent(0xff == aColor.GetTransparency());
- maCurColor = aColor;
-
- if (bIsTransparent)
- {
- pBmpAcc->SetFillColor();
- }
- else
- {
- pBmpAcc->SetFillColor(maCurColor);
- }
-
- if (maBmpSize.Width() == maBmpSize.Height())
- // tdf#84985 align color bar with icon bottom edge; integer arithmetic e.g. 26 - 26/4 <> 26 * 3/4
- maUpdRect = tools::Rectangle(Point( 0, maBmpSize.Height() - maBmpSize.Height() / 4), Size(maBmpSize.Width(), maBmpSize.Height() / 4));
- else
- maUpdRect = tools::Rectangle(Point( maBmpSize.Height() + 2, 2), Point(maBmpSize.Width() - 3, maBmpSize.Height() - 3));
-
- pBmpAcc->DrawRect(maUpdRect);
-
- if (pMskAcc)
- {
- if (bIsTransparent)
- {
- pMskAcc->SetLineColor(COL_BLACK);
- pMskAcc->SetFillColor(COL_WHITE);
- }
- else
- pMskAcc->SetFillColor(COL_BLACK);
-
- pMskAcc->DrawRect(maUpdRect);
- }
-
- Bitmap::ReleaseAccess(pBmpAcc);
-
- if (pMskAcc)
- Bitmap::ReleaseAccess(pMskAcc);
-
- if (aBmpEx.IsAlpha())
- aBmpEx = BitmapEx(aBmp, AlphaMask(aMsk));
- else if (aBmpEx.IsTransparent())
- aBmpEx = BitmapEx(aBmp, aMsk);
- else
- aBmpEx = aBmp;
-
- mpTbx->SetItemImage(mnBtnId, Image(aBmpEx));
+ pMskAcc->SetLineColor(COL_BLACK);
+ pMskAcc->SetFillColor(COL_WHITE);
}
+ else
+ pMskAcc->SetFillColor(COL_BLACK);
+
+ pMskAcc->DrawRect(maUpdRect);
}
+
+ Bitmap::ReleaseAccess(pBmpAcc);
+
+ if (pMskAcc)
+ Bitmap::ReleaseAccess(pMskAcc);
+
+ if (aBmpEx.IsAlpha())
+ aBmpEx = BitmapEx(aBmp, AlphaMask(aMsk));
+ else if (aBmpEx.IsTransparent())
+ aBmpEx = BitmapEx(aBmp, aMsk);
+ else
+ aBmpEx = aBmp;
+
+ mpTbx->SetItemImage(mnBtnId, Image(aBmpEx));
}
}
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index ec0cd05601e0..3d1328a44a2e 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -409,43 +409,43 @@ void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
"SvxShape::Create: the same shape used for two different objects?! Strange ..." );
// Correct condition (#i52126#)
- if ( pCreatedObj != pNewObj )
- {
- DBG_ASSERT( pNewObj->GetModel(), "no model for SdrObject?" );
- // Correct condition (#i52126#)
- mpImpl->mpCreatedObj = pNewObj;
+ if ( pCreatedObj == pNewObj )
+ return;
- if( mpObj.is() && mpObj->GetModel() )
- {
- EndListening( *mpObj->GetModel() );
- }
+ DBG_ASSERT( pNewObj->GetModel(), "no model for SdrObject?" );
+ // Correct condition (#i52126#)
+ mpImpl->mpCreatedObj = pNewObj;
+
+ if( mpObj.is() && mpObj->GetModel() )
+ {
+ EndListening( *mpObj->GetModel() );
+ }
- mpObj.reset( pNewObj );
+ mpObj.reset( pNewObj );
- OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
- // this was previously set in impl_initFromSdrObject, but I think it was superfluous
- // (it definitely was in the other context where it was called, but I strongly suppose
- // it was also superfluous when called from here)
- impl_initFromSdrObject();
+ OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
+ // this was previously set in impl_initFromSdrObject, but I think it was superfluous
+ // (it definitely was in the other context where it was called, but I strongly suppose
+ // it was also superfluous when called from here)
+ impl_initFromSdrObject();
- ObtainSettingsFromPropertySet( *mpPropSet );
+ ObtainSettingsFromPropertySet( *mpPropSet );
- // save user call
- SdrObjUserCall* pUser = mpObj->GetUserCall();
- mpObj->SetUserCall(nullptr);
+ // save user call
+ SdrObjUserCall* pUser = mpObj->GetUserCall();
+ mpObj->SetUserCall(nullptr);
- setPosition( maPosition );
- setSize( maSize );
+ setPosition( maPosition );
+ setSize( maSize );
- // restore user call after we set the initial size
- mpObj->SetUserCall( pUser );
+ // restore user call after we set the initial size
+ mpObj->SetUserCall( pUser );
- // if this shape was already named, use this name
- if( !maShapeName.isEmpty() )
- {
- mpObj->SetName( maShapeName );
- maShapeName.clear();
- }
+ // if this shape was already named, use this name
+ if( !maShapeName.isEmpty() )
+ {
+ mpObj->SetName( maShapeName );
+ maShapeName.clear();
}
}
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx
index e8ea3ee0392a..2fdc6f028ab5 100644
--- a/svx/source/xoutdev/_xpoly.cxx
+++ b/svx/source/xoutdev/_xpoly.cxx
@@ -666,26 +666,26 @@ void XPolygon::CalcTangent(sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNex
{
double fAbsLen = CalcDistance(nNext, nPrev);
- if ( fAbsLen )
- {
- const Point& rCenter = pImpXPolygon->pPointAry[nCenter];
- Point& rNext = pImpXPolygon->pPointAry[nNext];
- Point& rPrev = pImpXPolygon->pPointAry[nPrev];
- Point aDiff = rNext - rPrev;
- double fNextLen = CalcDistance(nCenter, nNext) / fAbsLen;
- double fPrevLen = CalcDistance(nCenter, nPrev) / fAbsLen;
+ if ( !fAbsLen )
+ return;
- // same length for both sides if SYMMTR
- if ( GetFlags(nCenter) == PolyFlags::Symmetric )
- {
- fPrevLen = (fNextLen + fPrevLen) / 2;
- fNextLen = fPrevLen;
- }
- rNext.X() = rCenter.X() + (long) (fNextLen * aDiff.X());
- rNext.Y() = rCenter.Y() + (long) (fNextLen * aDiff.Y());
- rPrev.X() = rCenter.X() - (long) (fPrevLen * aDiff.X());
- rPrev.Y() = rCenter.Y() - (long) (fPrevLen * aDiff.Y());
+ const Point& rCenter = pImpXPolygon->pPointAry[nCenter];
+ Point& rNext = pImpXPolygon->pPointAry[nNext];
+ Point& rPrev = pImpXPolygon->pPointAry[nPrev];
+ Point aDiff = rNext - rPrev;
+ double fNextLen = CalcDistance(nCenter, nNext) / fAbsLen;
+ double fPrevLen = CalcDistance(nCenter, nPrev) / fAbsLen;
+
+ // same length for both sides if SYMMTR
+ if ( GetFlags(nCenter) == PolyFlags::Symmetric )
+ {
+ fPrevLen = (fNextLen + fPrevLen) / 2;
+ fNextLen = fPrevLen;
}
+ rNext.X() = rCenter.X() + (long) (fNextLen * aDiff.X());
+ rNext.Y() = rCenter.Y() + (long) (fNextLen * aDiff.Y());
+ rPrev.X() = rCenter.X() - (long) (fPrevLen * aDiff.X());
+ rPrev.Y() = rCenter.Y() - (long) (fPrevLen * aDiff.Y());
}
/// convert four polygon points into a B├ęzier curve
@@ -793,39 +793,39 @@ void XPolygon::Distort(const tools::Rectangle& rRefRect,
Wr = rRefRect.GetWidth();
Hr = rRefRect.GetHeight();
- if ( Wr && Hr )
- {
- long X1, X2, X3, X4;
- long Y1, Y2, Y3, Y4;
- DBG_ASSERT(rDistortedRect.pImpXPolygon->nPoints >= 4,
- "Distort: rectangle to small");
+ if ( !Wr || !Hr )
+ return;
- X1 = rDistortedRect[0].X();
- Y1 = rDistortedRect[0].Y();
- X2 = rDistortedRect[1].X();
- Y2 = rDistortedRect[1].Y();
- X3 = rDistortedRect[3].X();
- Y3 = rDistortedRect[3].Y();
- X4 = rDistortedRect[2].X();
- Y4 = rDistortedRect[2].Y();
+ long X1, X2, X3, X4;
+ long Y1, Y2, Y3, Y4;
+ DBG_ASSERT(rDistortedRect.pImpXPolygon->nPoints >= 4,
+ "Distort: rectangle to small");
- sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+ X1 = rDistortedRect[0].X();
+ Y1 = rDistortedRect[0].Y();
+ X2 = rDistortedRect[1].X();
+ Y2 = rDistortedRect[1].Y();
+ X3 = rDistortedRect[3].X();
+ Y3 = rDistortedRect[3].Y();
+ X4 = rDistortedRect[2].X();
+ Y4 = rDistortedRect[2].Y();
- for (sal_uInt16 i = 0; i < nPntCnt; i++)
- {
- double fTx, fTy, fUx, fUy;
- Point& rPnt = pImpXPolygon->pPointAry[i];
-
- fTx = (double)(rPnt.X() - Xr) / Wr;
- fTy = (double)(rPnt.Y() - Yr) / Hr;
- fUx = 1.0 - fTx;
- fUy = 1.0 - fTy;
-
- rPnt.X() = (long) ( fUy * (fUx * X1 + fTx * X2) +
- fTy * (fUx * X3 + fTx * X4) );
- rPnt.Y() = (long) ( fUx * (fUy * Y1 + fTy * Y3) +
- fTx * (fUy * Y2 + fTy * Y4) );
- }
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ {
+ double fTx, fTy, fUx, fUy;
+ Point& rPnt = pImpXPolygon->pPointAry[i];
+
+ fTx = (double)(rPnt.X() - Xr) / Wr;
+ fTy = (double)(rPnt.Y() - Yr) / Hr;
+ fUx = 1.0 - fTx;
+ fUy = 1.0 - fTy;
+
+ rPnt.X() = (long) ( fUy * (fUx * X1 + fTx * X2) +
+ fTy * (fUx * X3 + fTx * X4) );
+ rPnt.Y() = (long) ( fUx * (fUy * Y1 + fTy * Y3) +
+ fTx * (fUy * Y2 + fTy * Y4) );
}
}