summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/ado/APreparedStatement.cxx
blob: aea1232e59254bb021069f1bd4485282e960833a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <connectivity/sqlparse.hxx>
#include "ado/APreparedStatement.hxx"
#include <com/sun/star/sdbc/DataType.hpp>
#include "ado/AResultSetMetaData.hxx"
#include "ado/AResultSet.hxx"
#include "ado/ADriver.hxx"
#include <com/sun/star/lang/DisposedException.hpp>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/dbtools.hxx>
#include "resource/ado_res.hrc"

#include <limits>

#define CHECK_RETURN(x)                                                 \
    if(!x)                                                              \
        ADOS::ThrowException(*m_pConnection->getConnection(),*this);

#ifdef max
#   undef max
#endif

using namespace connectivity::ado;
using namespace connectivity;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::sdbc;
using namespace com::sun::star::util;

IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.APreparedStatement","com.sun.star.sdbc.PreparedStatement");

OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const OTypeInfoMap& _TypeInfo,const OUString& sql)
    : OStatement_Base( _pConnection )
    ,m_aTypeInfo(_TypeInfo)
{
    osl_atomic_increment( &m_refCount );

    OSQLParser aParser(comphelper::getComponentContext(_pConnection->getDriver()->getORB()));
    OUString sErrorMessage;
    OUString sNewSql;
    OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,sql);
    if(pNode)
    {   // special handling for parameters
        //  we recursive replace all occurrences of ? in the statement and
        //  replace them with name like "parame" */
        sal_Int32 nParameterCount = 0;
        OUString sDefaultName( "parame" );
        replaceParameterNodeName(pNode,sDefaultName,nParameterCount);
        pNode->parseNodeToStr( sNewSql, _pConnection );
        delete pNode;
    }
    else
        sNewSql = sql;
    CHECK_RETURN(m_Command.put_CommandText(sNewSql))
    CHECK_RETURN(m_Command.put_Prepared(VARIANT_TRUE))
    m_pParameters = m_Command.get_Parameters();
    m_pParameters->AddRef();
    m_pParameters->Refresh();

    osl_atomic_decrement( &m_refCount );
}

OPreparedStatement::~OPreparedStatement()
{
    if (m_pParameters)
    {
        OSL_FAIL( "OPreparedStatement::~OPreparedStatement: not disposed!" );
        m_pParameters->Release();
        m_pParameters = NULL;
    }
}

Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
{
    Any aRet = OStatement_Base::queryInterface(rType);
    return aRet.hasValue() ? aRet : ::cppu::queryInterface( rType,
                                        static_cast< XPreparedStatement*>(this),
                                        static_cast< XParameters*>(this),
                                        static_cast< XResultSetMetaDataSupplier*>(this));
}

::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes(  ) throw(::com::sun::star::uno::RuntimeException)
{
    ::cppu::OTypeCollection aTypes( cppu::UnoType<XPreparedStatement>::get(),
                                    cppu::UnoType<XParameters>::get(),
                                    cppu::UnoType<XResultSetMetaDataSupplier>::get());

    return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_Base::getTypes());
}

Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData(  ) throw(SQLException, RuntimeException)
{
    if(!m_xMetaData.is() && m_RecordSet.IsValid())
        m_xMetaData = new OResultSetMetaData(m_RecordSet);
    return m_xMetaData;
}

void OPreparedStatement::disposing()
{
m_xMetaData.clear();
    if (m_pParameters)
    {
        m_pParameters->Release();
        m_pParameters = NULL;
    }
    OStatement_Base::disposing();
}

void SAL_CALL OPreparedStatement::close(  ) throw(SQLException, RuntimeException)
{

    {
        ::osl::MutexGuard aGuard( m_aMutex );
        checkDisposed(OStatement_BASE::rBHelper.bDisposed);

    }
    dispose();

}

sal_Bool SAL_CALL OPreparedStatement::execute(  ) throw(SQLException, RuntimeException)
{
    ::osl::MutexGuard aGuard( m_aMutex );
    checkDisposed(OStatement_BASE::rBHelper.bDisposed);

    SQLWarning  warning;
    clearWarnings ();

    // Call SQLExecute
    try {
        ADORecordset* pSet=NULL;
        CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdUnknown,&pSet))
        m_RecordSet = WpADORecordset(pSet);
    }
    catch (SQLWarning& ex)
    {
        // Save pointer to warning and save with ResultSet
        // object once it is created.

        warning = ex;
    }
    return m_RecordSet.IsValid();
}

sal_Int32 SAL_CALL OPreparedStatement::executeUpdate(  ) throw(SQLException, RuntimeException)
{
    ::osl::MutexGuard aGuard( m_aMutex );
    checkDisposed(OStatement_BASE::rBHelper.bDisposed);


    ADORecordset* pSet=NULL;
    CHECK_RETURN(m_Command.Execute(m_RecordsAffected,m_Parameters,adCmdUnknown,&pSet))
    if ( VT_ERROR == m_RecordsAffected.getType() )
    {
        ADOS::ThrowException(*m_pConnection->getConnection(),*this);
        // to be sure that we get the error really thrown
        throw SQLException();
    }
    m_RecordSet = WpADORecordset(pSet);
    return  static_cast<sal_Int32>(m_RecordsAffected);
}

void OPreparedStatement::setParameter(sal_Int32 parameterIndex, const DataTypeEnum& _eType,
                                      const sal_Int32& _nSize,const OLEVariant& _Val) throw(SQLException, RuntimeException)
{
    ::osl::MutexGuard aGuard( m_aMutex );
    checkDisposed(OStatement_BASE::rBHelper.bDisposed);


    sal_Int32 nCount = 0;
    m_pParameters->get_Count(&nCount);
    if(nCount < (parameterIndex-1))
    {
        OUString sDefaultName( "parame" );
        sDefaultName += OUString::number(parameterIndex);
        ADOParameter* pParam = m_Command.CreateParameter(sDefaultName,_eType,adParamInput,_nSize,_Val);
        if(pParam)
        {
            m_pParameters->Append(pParam);
#if OSL_DEBUG_LEVEL > 0
            ADOParameter* pParam = NULL;
            m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
            WpADOParameter aParam(pParam);
            if(pParam)
            {
                DataTypeEnum eType = aParam.GetADOType();
                (void)eType;
            }
#endif
        }
    }
    else
    {
        ADOParameter* pParam = NULL;
        m_pParameters->get_Item(OLEVariant(sal_Int32(parameterIndex-1)),&pParam);
        WpADOParameter aParam(pParam);
        if(pParam)
        {
            DataTypeEnum eType = aParam.GetADOType();
            if ( _eType != eType && _eType != adDBTimeStamp )
            {
                aParam.put_Type(_eType);
                eType = _eType;
                aParam.put_Size(_nSize);
            }

            if ( adVarBinary == eType && aParam.GetAttributes() == adParamLong )
            {
                aParam.AppendChunk(_Val);
            }
            else
                CHECK_RETURN(aParam.PutValue(_Val));
        }
    }
    ADOS::ThrowException(*m_pConnection->getConnection(),*this);
}

void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const OUString& x ) throw(SQLException, RuntimeException)
{
    setParameter( parameterIndex, adLongVarWChar, ::std::numeric_limits< sal_Int32 >::max(), x );
}

Reference< XConnection > SAL_CALL OPreparedStatement::getConnection(  ) throw(SQLException, RuntimeException)
{
    ::osl::MutexGuard aGuard( m_aMutex );
    checkDisposed(OStatement_BASE::rBHelper.bDisposed);

    return (Reference< XConnection >)m_pConnection;
}

Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery(  ) throw(SQLException, RuntimeException)
{
    ::osl::MutexGuard aGuard( m_aMutex );
    checkDisposed(OStatement_BASE::rBHelper.bDisposed);

    // first clear the old things
    m_xMetaData.clear();
    disposeResultSet();
    if(m_RecordSet.IsValid())
        m_RecordSet.Close();
    m_RecordSet.clear();

    // the create the new onces
    m_RecordSet.Create();
    OLEVariant aCmd;
    aCmd.setIDispatch(m_Command);
    OLEVariant aCon;
    aCon.setNoArg();
    CHECK_RETURN(m_RecordSet.put_CacheSize(m_nFetchSize))
    CHECK_RETURN(m_RecordSet.put_MaxRecords(m_nMaxRows))
    CHECK_RETURN(m_RecordSet.Open(aCmd,aCon,m_eCursorType,m_eLockType,adOpenUnspecified))
    CHECK_RETURN(m_RecordSet.get_CacheSize(m_nFetchSize))
    CHECK_RETURN(m_RecordSet.get_MaxRecords(m_nMaxRows))
    CHECK_RETURN(m_RecordSet.get_CursorType(m_eCursorType))
    CHECK_RETURN(m_RecordSet.get_LockType(m_eLockType))

    OResultSet* pSet = new OResultSet(m_RecordSet,this);
    Reference< XResultSet > xRs = pSet;
    pSet->construct();
    pSet->setMetaData(getMetaData());
    m_xResultSet = WeakReference<XResultSet>(xRs);

    return xRs;
}

void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adBoolean,sizeof(x),bool(x));
}

void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adTinyInt,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adDBDate,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const css::util::Time& x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adDBTime,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adDBTimeStamp,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adDouble,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adSingle,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adInteger,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adBigInt,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
{
    OLEVariant aVal;
    aVal.setNull();
    setParameter(parameterIndex,adEmpty,0,aVal);
}

void SAL_CALL OPreparedStatement::setClob( sal_Int32 /*parameterIndex*/, const Reference< XClob >& /*x*/ ) throw(SQLException, RuntimeException)
{
    ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::setClob", *this );
}

void SAL_CALL OPreparedStatement::setBlob( sal_Int32 /*parameterIndex*/, const Reference< XBlob >& /*x*/ ) throw(SQLException, RuntimeException)
{
    ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::setBlob", *this );
}

void SAL_CALL OPreparedStatement::setArray( sal_Int32 /*parameterIndex*/, const Reference< XArray >& /*x*/ ) throw(SQLException, RuntimeException)
{
    ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::setArray", *this );
}

void SAL_CALL OPreparedStatement::setRef( sal_Int32 /*parameterIndex*/, const Reference< XRef >& /*x*/ ) throw(SQLException, RuntimeException)
{
    ::dbtools::throwFeatureNotImplementedSQLException( "XRowUpdate::setRef", *this );
}

void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException)
{
    switch(sqlType)
    {
        case DataType::DECIMAL:
        case DataType::NUMERIC:
            setString(parameterIndex,::comphelper::getString(x));
            break;
        default:
            ::dbtools::setObjectWithInfo(this,parameterIndex,x,sqlType,scale);
            break;
    }
}

void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_Int32 sqlType, const OUString& /*typeName*/ ) throw(SQLException, RuntimeException)
{
    setNull(parameterIndex,sqlType);
}

void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any& x ) throw(SQLException, RuntimeException)
{
    if(!::dbtools::implSetObject(this,parameterIndex,x))
    {
        const OUString sError( m_pConnection->getResources().getResourceStringWithSubstitution(
                STR_UNKNOWN_PARA_TYPE,
                "$position$", OUString::number(parameterIndex)
             ) );
        ::dbtools::throwGenericSQLException(sError,*this);
    }
}

void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adSmallInt,sizeof(x),x);
}

void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
{
    setParameter(parameterIndex,adVarBinary,sizeof(sal_Int8)*x.getLength(),x);
}

void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 /*parameterIndex*/, const Reference< ::com::sun::star::io::XInputStream >& /*x*/, sal_Int32 /*length*/ ) throw(SQLException, RuntimeException)
{
    ::dbtools::throwFeatureNotImplementedSQLException( "XParameters::setCharacterStream", *this );
}

void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
{
    if(x.is())
    {
        Sequence< sal_Int8 > aData;
        x->readBytes(aData,length);
        setBytes(parameterIndex,aData);
    }
}

void SAL_CALL OPreparedStatement::clearParameters(  ) throw(SQLException, RuntimeException)
{
    ::osl::MutexGuard aGuard( m_aMutex );
    checkDisposed(OStatement_BASE::rBHelper.bDisposed);


    if(m_pParameters)
    {
        sal_Int32 nCount = 0;
        m_pParameters->get_Count(&nCount);
        OLEVariant aVal;
        aVal.setEmpty();
        for(sal_Int32 i=0;i<nCount;++i)
        {
            ADOParameter* pParam = NULL;
            m_pParameters->get_Item(OLEVariant(i),&pParam);
            WpADOParameter aParam(pParam);
            if(pParam)
            {
                CHECK_RETURN(aParam.PutValue(aVal));
            }
        }
    }
}

void SAL_CALL OPreparedStatement::acquire() throw()
{
    OStatement_Base::acquire();
}

void SAL_CALL OPreparedStatement::release() throw()
{
    OStatement_Base::release();
}

void OPreparedStatement::replaceParameterNodeName(OSQLParseNode* _pNode,
                                                  const OUString& _sDefaultName,
                                                  sal_Int32& _rParameterCount)
{
    sal_Int32 nCount = _pNode->count();
    for(sal_Int32 i=0;i < nCount;++i)
    {
        OSQLParseNode* pChildNode = _pNode->getChild(i);
        if(SQL_ISRULE(pChildNode,parameter) && pChildNode->count() == 1)
        {
            OSQLParseNode* pNewNode = new OSQLParseNode(OUString(":") ,SQL_NODE_PUNCTUATION,0);
            delete pChildNode->replace(pChildNode->getChild(0),pNewNode);
            OUString sParameterName = _sDefaultName;
            sParameterName += OUString::number(++_rParameterCount);
            pChildNode->append(new OSQLParseNode( sParameterName,SQL_NODE_NAME,0));
        }
        else
            replaceParameterNodeName(pChildNode,_sDefaultName,_rParameterCount);

    }
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
// If the drag point was limited and Ortho is active, do
+ // the small ortho correction (reduction) -> last parameter to FALSE.
+ bool bDidLimit(ImpLimitToWorkArea(aPnt));
+ if(bDidLimit && IsOrtho())
+ {
+ if(maDragStat.IsOrtho8Possible())
+ OrthoDistance8(maDragStat.GetPrev(), aPnt, false);
+ else if(maDragStat.IsOrtho4Possible())
+ OrthoDistance4(maDragStat.GetPrev(), aPnt, false);
+ }
- // MovCreate changes the object, so use ActionChanged() on it
- pCurrentCreate->ActionChanged();
+ if (aPnt==maDragStat.GetNow()) return;
+ bool bIsMinMoved(maDragStat.IsMinMoved());
+ if (!maDragStat.CheckMinMoved(aPnt))
+ return;
- // replace for DrawCreateObjDiff
- HideCreateObj();
- ShowCreateObj();
- }
- }
+ if (!bIsMinMoved) maDragStat.NextPoint();
+ maDragStat.NextMove(aPnt);
+ pCurrentCreate->MovCreate(maDragStat);
+
+ // MovCreate changes the object, so use ActionChanged() on it
+ pCurrentCreate->ActionChanged();
+
+ // replace for DrawCreateObjDiff
+ HideCreateObj();
+ ShowCreateObj();
}
void SdrCreateView::SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj)
@@ -705,24 +706,24 @@ bool SdrCreateView::EndCreateObj(SdrCreateCmd eCmd)
void SdrCreateView::BckCreateObj()
{
- if (pCurrentCreate!=nullptr)
+ if (pCurrentCreate==nullptr)
+ return;
+
+ if (maDragStat.GetPointCount()<=2 )
+ {
+ BrkCreateObj();
+ }
+ else
{
- if (maDragStat.GetPointCount()<=2 )
+ HideCreateObj();
+ maDragStat.PrevPoint();
+ if (pCurrentCreate->BckCreate(maDragStat))
{
- BrkCreateObj();
+ ShowCreateObj();
}
else
{
- HideCreateObj();
- maDragStat.PrevPoint();
- if (pCurrentCreate->BckCreate(maDragStat))
- {
- ShowCreateObj();
- }
- else
- {
- BrkCreateObj();
- }
+ BrkCreateObj();
}
}
}
@@ -741,117 +742,117 @@ void SdrCreateView::BrkCreateObj()
void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/)
{
- if(IsCreateObj() && !maDragStat.IsShown())
+ if(!(IsCreateObj() && !maDragStat.IsShown()))
+ return;
+
+ if(pCurrentCreate)
{
- if(pCurrentCreate)
+ // for migration from XOR, replace DrawDragObj here to create
+ // overlay objects instead.
+ bool bUseSolidDragging(IsSolidDragging());
+
+ // #i101648# check if dragged object is a naked SdrObject (not
+ // a derivation). This is e.g. used in SW Frame construction
+ // as placeholder. Do not use SolidDragging for naked SdrObjects,
+ // they cannot have a valid optical representation
+ if(bUseSolidDragging && OBJ_NONE == pCurrentCreate->GetObjIdentifier())
{
- // for migration from XOR, replace DrawDragObj here to create
- // overlay objects instead.
- bool bUseSolidDragging(IsSolidDragging());
-
- // #i101648# check if dragged object is a naked SdrObject (not
- // a derivation). This is e.g. used in SW Frame construction
- // as placeholder. Do not use SolidDragging for naked SdrObjects,
- // they cannot have a valid optical representation
- if(bUseSolidDragging && OBJ_NONE == pCurrentCreate->GetObjIdentifier())
+ bUseSolidDragging = false;
+ }
+
+ // check for objects with no fill and no line
+ if(bUseSolidDragging)
+ {
+ const SfxItemSet& rSet = pCurrentCreate->GetMergedItemSet();
+ const drawing::FillStyle eFill(rSet.Get(XATTR_FILLSTYLE).GetValue());
+ const drawing::LineStyle eLine(rSet.Get(XATTR_LINESTYLE).GetValue());
+
+ if(drawing::LineStyle_NONE == eLine && drawing::FillStyle_NONE == eFill)
{
bUseSolidDragging = false;
}
+ }
- // check for objects with no fill and no line
- if(bUseSolidDragging)
+ // check for form controls
+ if(bUseSolidDragging)
+ {
+ if(dynamic_cast<const SdrUnoObj*>( pCurrentCreate) != nullptr)
{
- const SfxItemSet& rSet = pCurrentCreate->GetMergedItemSet();
- const drawing::FillStyle eFill(rSet.Get(XATTR_FILLSTYLE).GetValue());
- const drawing::LineStyle eLine(rSet.Get(XATTR_LINESTYLE).GetValue());
-
- if(drawing::LineStyle_NONE == eLine && drawing::FillStyle_NONE == eFill)
- {
- bUseSolidDragging = false;
- }
+ bUseSolidDragging = false;
}
+ }
+
+ // #i101781# force to non-solid dragging when not creating a full circle
+ if(bUseSolidDragging)
+ {
+ SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pCurrentCreate);
- // check for form controls
- if(bUseSolidDragging)
+ if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier())
{
- if(dynamic_cast<const SdrUnoObj*>( pCurrentCreate) != nullptr)
+ // #i103058# Allow SolidDragging with four points
+ if(maDragStat.GetPointCount() < 4)
{
bUseSolidDragging = false;
}
}
+ }
+
+ if(bUseSolidDragging)
+ {
+ basegfx::B2DPolyPolygon aDragPolyPolygon;
- // #i101781# force to non-solid dragging when not creating a full circle
- if(bUseSolidDragging)
+ if(dynamic_cast<const SdrRectObj*>( pCurrentCreate) != nullptr)
{
- SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pCurrentCreate);
+ // ensure object has some size, necessary for SdrTextObj because
+ // there are still untested divisions by that sizes
+ tools::Rectangle aCurrentSnapRect(pCurrentCreate->GetSnapRect());
- if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier())
+ if(aCurrentSnapRect.GetWidth() <= 1 || aCurrentSnapRect.GetHeight() <= 1)
{
- // #i103058# Allow SolidDragging with four points
- if(maDragStat.GetPointCount() < 4)
- {
- bUseSolidDragging = false;
- }
+ tools::Rectangle aNewRect(maDragStat.GetStart(), maDragStat.GetStart() + Point(2, 2));
+ pCurrentCreate->NbcSetSnapRect(aNewRect);
}
}
- if(bUseSolidDragging)
+ if(dynamic_cast<const SdrPathObj*>( pCurrentCreate) != nullptr)
{
- basegfx::B2DPolyPolygon aDragPolyPolygon;
+ // The up-to-now created path needs to be set at the object to have something
+ // that can be visualized
+ SdrPathObj& rPathObj(static_cast<SdrPathObj&>(*pCurrentCreate));
+ const basegfx::B2DPolyPolygon aCurrentPolyPolygon(rPathObj.getObjectPolyPolygon(maDragStat));
- if(dynamic_cast<const SdrRectObj*>( pCurrentCreate) != nullptr)
+ if(aCurrentPolyPolygon.count())
{
- // ensure object has some size, necessary for SdrTextObj because
- // there are still untested divisions by that sizes
- tools::Rectangle aCurrentSnapRect(pCurrentCreate->GetSnapRect());
-
- if(aCurrentSnapRect.GetWidth() <= 1 || aCurrentSnapRect.GetHeight() <= 1)
- {
- tools::Rectangle aNewRect(maDragStat.GetStart(), maDragStat.GetStart() + Point(2, 2));
- pCurrentCreate->NbcSetSnapRect(aNewRect);
- }
+ rPathObj.NbcSetPathPoly(aCurrentPolyPolygon);
}
- if(dynamic_cast<const SdrPathObj*>( pCurrentCreate) != nullptr)
- {
- // The up-to-now created path needs to be set at the object to have something
- // that can be visualized
- SdrPathObj& rPathObj(static_cast<SdrPathObj&>(*pCurrentCreate));
- const basegfx::B2DPolyPolygon aCurrentPolyPolygon(rPathObj.getObjectPolyPolygon(maDragStat));
-
- if(aCurrentPolyPolygon.count())
- {
- rPathObj.NbcSetPathPoly(aCurrentPolyPolygon);
- }
+ aDragPolyPolygon = rPathObj.getDragPolyPolygon(maDragStat);
+ }
- aDragPolyPolygon = rPathObj.getDragPolyPolygon(maDragStat);
- }
+ // use the SdrObject directly for overlay
+ mpCreateViewExtraData->CreateAndShowOverlay(*this, pCurrentCreate, aDragPolyPolygon);
+ }
+ else
+ {
+ const ::basegfx::B2DPolyPolygon aPoly(pCurrentCreate->TakeCreatePoly(maDragStat));
- // use the SdrObject directly for overlay
- mpCreateViewExtraData->CreateAndShowOverlay(*this, pCurrentCreate, aDragPolyPolygon);
- }
- else
- {
- const ::basegfx::B2DPolyPolygon aPoly(pCurrentCreate->TakeCreatePoly(maDragStat));
+ mpCreateViewExtraData->CreateAndShowOverlay(*this, nullptr, aPoly);
+ }
- mpCreateViewExtraData->CreateAndShowOverlay(*this, nullptr, aPoly);
- }
+ // #i101679# Force changed overlay to be shown
+ for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
+ {
+ SdrPaintWindow* pCandidate = GetPaintWindow(a);
+ const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager = pCandidate->GetOverlayManager();
- // #i101679# Force changed overlay to be shown
- for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
+ if (xOverlayManager.is())
{
- SdrPaintWindow* pCandidate = GetPaintWindow(a);
- const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager = pCandidate->GetOverlayManager();
-
- if (xOverlayManager.is())
- {
- xOverlayManager->flush();
- }
+ xOverlayManager->flush();
}
}
-
- maDragStat.SetShown(true);
}
+
+ maDragStat.SetShown(true);
}
void SdrCreateView::HideCreateObj()
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 53a1f072ee84..22c70944d2bd 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -295,26 +295,26 @@ void SdrDragMethod::addSdrDragEntry(std::unique_ptr<SdrDragEntry> pNew)
void SdrDragMethod::createSdrDragEntries()
{
- if(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView())
+ if(!(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView()))
+ return;
+
+ if(getSdrDragView().IsDraggingPoints())
{
- if(getSdrDragView().IsDraggingPoints())
- {
- createSdrDragEntries_PointDrag();
- }
- else if(getSdrDragView().IsDraggingGluePoints())
+ createSdrDragEntries_PointDrag();
+ }
+ else if(getSdrDragView().IsDraggingGluePoints())
+ {
+ createSdrDragEntries_GlueDrag();
+ }
+ else
+ {
+ if(getSolidDraggingActive())
{
- createSdrDragEntries_GlueDrag();
+ createSdrDragEntries_SolidDrag();
}
else
{
- if(getSolidDraggingActive())
- {
- createSdrDragEntries_SolidDrag();
- }
- else
- {
- createSdrDragEntries_PolygonDrag();
- }
+ createSdrDragEntries_PolygonDrag();
}
}
}
@@ -366,51 +366,51 @@ void SdrDragMethod::createSdrDragEntries_SolidDrag()
const size_t nMarkCount(getSdrDragView().GetMarkedObjectCount());
SdrPageView* pPV = getSdrDragView().GetSdrPageView();
- if(pPV)
+ if(!pPV)
+ return;
+
+ for(size_t a = 0; a < nMarkCount; ++a)
{
- for(size_t a = 0; a < nMarkCount; ++a)
+ SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
+
+ if(pM->GetPageView() == pPV)
{
- SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
+ const SdrObject* pObject = pM->GetMarkedSdrObj();
- if(pM->GetPageView() == pPV)
+ if(pObject)
{
- const SdrObject* pObject = pM->GetMarkedSdrObj();
-
- if(pObject)
+ if(pPV->PageWindowCount())
{
- if(pPV->PageWindowCount())
+ SdrObjListIter aIter(*pObject);
+
+ while(aIter.IsMore())
{
- SdrObjListIter aIter(*pObject);
+ SdrObject* pCandidate = aIter.Next();
- while(aIter.IsMore())
+ if(pCandidate)
{
- SdrObject* pCandidate = aIter.Next();
+ const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
+ bool bAddWireframe(bSuppressFullDrag);
- if(pCandidate)
+ if(!bAddWireframe && !pCandidate->HasLineStyle())
{
- const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
- bool bAddWireframe(bSuppressFullDrag);
-
- if(!bAddWireframe && !pCandidate->HasLineStyle())
- {
- // add wireframe for objects without outline
- bAddWireframe = true;
- }
-
- if(!bSuppressFullDrag)
- {
- // add full object drag; Clone() at the object has to work
- // for this
- createSdrDragEntryForSdrObject(*pCandidate);
- }
-
- if(bAddWireframe)
- {
- // when dragging a 50% transparent copy of a filled or not filled object without
- // outline, this is normally hard to see. Add extra wireframe in that case. This
- // works nice e.g. with text frames etc.
- addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly())));
- }
+ // add wireframe for objects without outline
+ bAddWireframe = true;
+ }
+
+ if(!bSuppressFullDrag)
+ {
+ // add full object drag; Clone() at the object has to work
+ // for this
+ createSdrDragEntryForSdrObject(*pCandidate);
+ }
+
+ if(bAddWireframe)
+ {
+ // when dragging a 50% transparent copy of a filled or not filled object without
+ // outline, this is normally hard to see. Add extra wireframe in that case. This
+ // works nice e.g. with text frames etc.
+ addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly())));
}
}
}
@@ -809,25 +809,25 @@ void SdrDragMethod::CreateOverlayGeometry(
}
// add DragStripes if necessary (help lines cross the page when dragging)
- if(getSdrDragView().IsDragStripes())
- {
- tools::Rectangle aActionRectangle;
- getSdrDragView().TakeActionRect(aActionRectangle);
+ if(!getSdrDragView().IsDragStripes())
+ return;
- const basegfx::B2DPoint aTopLeft(aActionRectangle.Left(), aActionRectangle.Top());
- const basegfx::B2DPoint aBottomRight(aActionRectangle.Right(), aActionRectangle.Bottom());
- std::unique_ptr<sdr::overlay::OverlayRollingRectangleStriped> pNew(
- new sdr::overlay::OverlayRollingRectangleStriped(
- aTopLeft,
- aBottomRight,
- true,
- false));
+ tools::Rectangle aActionRectangle;
+ getSdrDragView().TakeActionRect(aActionRectangle);
- insertNewlyCreatedOverlayObjectForSdrDragMethod(
- std::move(pNew),
- rObjectContact,
- rOverlayManager);
- }
+ const basegfx::B2DPoint aTopLeft(aActionRectangle.Left(), aActionRectangle.Top());
+ const basegfx::B2DPoint aBottomRight(aActionRectangle.Right(), aActionRectangle.Bottom());
+ std::unique_ptr<sdr::overlay::OverlayRollingRectangleStriped> pNew(
+ new sdr::overlay::OverlayRollingRectangleStriped(
+ aTopLeft,
+ aBottomRight,
+ true,
+ false));
+
+ insertNewlyCreatedOverlayObjectForSdrDragMethod(
+ std::move(pNew),
+ rObjectContact,
+ rOverlayManager);
}
void SdrDragMethod::destroyOverlayGeometry()
@@ -998,111 +998,111 @@ void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
{
Point aPnt(rNoSnapPnt);
- if ( GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt))
+ if ( !(GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt)))
+ return;
+
+ if (GetDragHdl()->GetKind()==SdrHdlKind::MirrorAxis)
{
- if (GetDragHdl()->GetKind()==SdrHdlKind::MirrorAxis)
- {
- SdrHdl* pH1=GetHdlList().GetHdl(SdrHdlKind::Ref1);
- SdrHdl* pH2=GetHdlList().GetHdl(SdrHdlKind::Ref2);
+ SdrHdl* pH1=GetHdlList().GetHdl(SdrHdlKind::Ref1);
+ SdrHdl* pH2=GetHdlList().GetHdl(SdrHdlKind::Ref2);
- if (pH1==nullptr || pH2==nullptr)
- return;
+ if (pH1==nullptr || pH2==nullptr)
+ return;
- if (!DragStat().IsNoSnap())
- {
- long nBestXSnap=0;
- long nBestYSnap=0;
- bool bXSnapped=false;
- bool bYSnapped=false;
- Point aDif(aPnt-DragStat().GetStart());
- getSdrDragView().CheckSnap(Ref1()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
- getSdrDragView().CheckSnap(Ref2()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
- aPnt.AdjustX(nBestXSnap );
- aPnt.AdjustY(nBestYSnap );
- }
+ if (!DragStat().IsNoSnap())
+ {
+ long nBestXSnap=0;
+ long nBestYSnap=0;
+ bool bXSnapped=false;
+ bool bYSnapped=false;
+ Point aDif(aPnt-DragStat().GetStart());
+ getSdrDragView().CheckSnap(Ref1()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ getSdrDragView().CheckSnap(Ref2()+aDif,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
+ aPnt.AdjustX(nBestXSnap );
+ aPnt.AdjustY(nBestYSnap );
+ }
- if (aPnt!=DragStat().GetNow())
- {
- Hide();
- DragStat().NextMove(aPnt);
- Point aDif(DragStat().GetNow()-DragStat().GetStart());
- pH1->SetPos(Ref1()+aDif);
- pH2->SetPos(Ref2()+aDif);
+ if (aPnt!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+ Point aDif(DragStat().GetNow()-DragStat().GetStart());
+ pH1->SetPos(Ref1()+aDif);
+ pH2->SetPos(Ref2()+aDif);
- SdrHdl* pHM = GetHdlList().GetHdl(SdrHdlKind::MirrorAxis);
+ SdrHdl* pHM = GetHdlList().GetHdl(SdrHdlKind::MirrorAxis);
- if(pHM)
- pHM->Touch();
+ if(pHM)
+ pHM->Touch();
- Show();
- DragStat().SetActionRect(tools::Rectangle(pH1->GetPos(),pH2->GetPos()));
- }
+ Show();
+ DragStat().SetActionRect(tools::Rectangle(pH1->GetPos(),pH2->GetPos()));
}
- else
- {
- if (!DragStat().IsNoSnap()) SnapPos(aPnt);
- long nSA=0;
+ }
+ else
+ {
+ if (!DragStat().IsNoSnap()) SnapPos(aPnt);
+ long nSA=0;
- if (getSdrDragView().IsAngleSnapEnabled())
- nSA=getSdrDragView().GetSnapAngle();
+ if (getSdrDragView().IsAngleSnapEnabled())
+ nSA=getSdrDragView().GetSnapAngle();
- if (getSdrDragView().IsMirrorAllowed(true,true))
- { // limited
- if (!getSdrDragView().IsMirrorAllowed()) nSA=4500;
- if (!getSdrDragView().IsMirrorAllowed(true)) nSA=9000;
- }
+ if (getSdrDragView().IsMirrorAllowed(true,true))
+ { // limited
+ if (!getSdrDragView().IsMirrorAllowed()) nSA=4500;
+ if (!getSdrDragView().IsMirrorAllowed(true)) nSA=9000;
+ }
- if (getSdrDragView().IsOrtho() && nSA!=9000)
- nSA=4500;
+ if (getSdrDragView().IsOrtho() && nSA!=9000)
+ nSA=4500;
- if (nSA!=0)
- { // angle snapping
- SdrHdlKind eRef=SdrHdlKind::Ref1;
+ if (nSA!=0)
+ { // angle snapping
+ SdrHdlKind eRef=SdrHdlKind::Ref1;
- if (GetDragHdl()->GetKind()==SdrHdlKind::Ref1)
- eRef=SdrHdlKind::Ref2;
+ if (GetDragHdl()->GetKind()==SdrHdlKind::Ref1)
+ eRef=SdrHdlKind::Ref2;
- SdrHdl* pH=GetHdlList().GetHdl(eRef);
+ SdrHdl* pH=GetHdlList().GetHdl(eRef);
- if (pH!=nullptr)
+ if (pH!=nullptr)
+ {
+ Point aRef(pH->GetPos());
+ long nAngle=NormAngle36000(GetAngle(aPnt-aRef));
+ long nNewAngle=nAngle;
+ nNewAngle+=nSA/2;
+ nNewAngle/=nSA;
+ nNewAngle*=nSA;
+ nNewAngle=NormAngle36000(nNewAngle);
+ double a=(nNewAngle-nAngle)*F_PI18000;
+ double nSin=sin(a);
+ double nCos=cos(a);
+ RotatePoint(aPnt,aRef,nSin,nCos);
+
+ // eliminate rounding errors for certain values
+ if (nSA==9000)
{
- Point aRef(pH->GetPos());
- long nAngle=NormAngle36000(GetAngle(aPnt-aRef));
- long nNewAngle=nAngle;
- nNewAngle+=nSA/2;
- nNewAngle/=nSA;
- nNewAngle*=nSA;
- nNewAngle=NormAngle36000(nNewAngle);
- double a=(nNewAngle-nAngle)*F_PI18000;
- double nSin=sin(a);
- double nCos=cos(a);
- RotatePoint(aPnt,aRef,nSin,nCos);
-
- // eliminate rounding errors for certain values
- if (nSA==9000)
- {
- if (nNewAngle==0 || nNewAngle==18000) aPnt.setY(aRef.Y() );
- if (nNewAngle==9000 || nNewAngle==27000) aPnt.setX(aRef.X() );
- }
-
- if (nSA==4500)
- OrthoDistance8(aRef,aPnt,true);
+ if (nNewAngle==0 || nNewAngle==18000) aPnt.setY(aRef.Y() );
+ if (nNewAngle==9000 || nNewAngle==27000) aPnt.setX(aRef.X() );
}
+
+ if (nSA==4500)
+ OrthoDistance8(aRef,aPnt,true);
}
+ }
- if (aPnt!=DragStat().GetNow())
- {
- Hide();
- DragStat().NextMove(aPnt);
- GetDragHdl()->SetPos(DragStat().GetNow());
- SdrHdl* pHM = GetHdlList().GetHdl(SdrHdlKind::MirrorAxis);
+ if (aPnt!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPnt);
+ GetDragHdl()->SetPos(DragStat().GetNow());
+ SdrHdl* pHM = GetHdlList().GetHdl(SdrHdlKind::MirrorAxis);
- if(pHM)
- pHM->Touch();
+ if(pHM)
+ pHM->Touch();
- Show();
- DragStat().SetActionRect(tools::Rectangle(aPnt,aPnt));
- }
+ Show();
+ DragStat().SetActionRect(tools::Rectangle(aPnt,aPnt));
}
}
}
@@ -1178,52 +1178,52 @@ SdrDragObjOwn::~SdrDragObjOwn()
void SdrDragObjOwn::createSdrDragEntries()
{
- if(mxClone)
+ if(!mxClone)
+ return;
+
+ basegfx::B2DPolyPolygon aDragPolyPolygon;
+ bool bAddWireframe(true);
+
+ if(getSolidDraggingActive())
{
- basegfx::B2DPolyPolygon aDragPolyPolygon;
- bool bAddWireframe(true);
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
- if(getSolidDraggingActive())
+ if(pPV && pPV->PageWindowCount())
{
- SdrPageView* pPV = getSdrDragView().GetSdrPageView();
-
- if(pPV && pPV->PageWindowCount())
- {
- addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntrySdrObject(*mxClone, false)));
+ addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntrySdrObject(*mxClone, false)));
- // potentially no wireframe needed, full drag works
- bAddWireframe = false;
- }
+ // potentially no wireframe needed, full drag works
+ bAddWireframe = false;
}
+ }
- if(!bAddWireframe)
+ if(!bAddWireframe)
+ {
+ // check for extra conditions for wireframe, e.g. no border at
+ // objects
+ if(!mxClone->HasLineStyle())
{
- // check for extra conditions for wireframe, e.g. no border at
- // objects
- if(!mxClone->HasLineStyle())
- {
- bAddWireframe = true;
- }
+ bAddWireframe = true;
}
+ }
- if(bAddWireframe)
- {
- // use wireframe poly when full drag is off or did not work
- aDragPolyPolygon = mxClone->TakeXorPoly();
- }
+ if(bAddWireframe)
+ {
+ // use wireframe poly when full drag is off or did not work
+ aDragPolyPolygon = mxClone->TakeXorPoly();
+ }
- // add evtl. extra DragPolyPolygon
- const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mxClone->getSpecialDragPoly(DragStat()));
+ // add evtl. extra DragPolyPolygon
+ const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mxClone->getSpecialDragPoly(DragStat()));
- if(aSpecialDragPolyPolygon.count())
- {
- aDragPolyPolygon.append(aSpecialDragPolyPolygon);
- }
+ if(aSpecialDragPolyPolygon.count())
+ {
+ aDragPolyPolygon.append(aSpecialDragPolyPolygon);
+ }
- if(aDragPolyPolygon.count())
- {
- addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragPolyPolygon)));
- }
+ if(aDragPolyPolygon.count())
+ {
+ addSdrDragEntry(std::unique_ptr<SdrDragEntry>(new SdrDragEntryPolyPolygon(aDragPolyPolygon)));
}
}
@@ -1525,21 +1525,21 @@ void SdrDragMove::ImpCheckSnap(const Point& rPt)
}
}
- if (nRet & SdrSnap::YSNAPPED)
+ if (!(nRet & SdrSnap::YSNAPPED))
+ return;
+
+ if (bYSnapped)
{
- if (bYSnapped)
- {
- if (std::abs(aPt.Y())<std::abs(nBestYSnap))
- {
- nBestYSnap=aPt.Y();
- }
- }
- else
+ if (std::abs(aPt.Y())<std::abs(nBestYSnap))
{
nBestYSnap=aPt.Y();
- bYSnapped=true;
}
}
+ else
+ {
+ nBestYSnap=aPt.Y();
+ bYSnapped=true;
+ }
}
void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
@@ -1571,110 +1571,110 @@ void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
if (bOrtho)
OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
- if (DragStat().CheckMinMoved(aNoSnapPnt))
+ if (!DragStat().CheckMinMoved(aNoSnapPnt))
+ return;
+
+ Point aPt1(aPnt);
+ tools::Rectangle aLR(getSdrDragView().GetWorkArea());
+ bool bWorkArea=!aLR.IsEmpty();
+ bool bDragLimit=IsDragLimit();
+
+ if (bDragLimit || bWorkArea)
{
- Point aPt1(aPnt);
- tools::Rectangle aLR(getSdrDragView().GetWorkArea());
- bool bWorkArea=!aLR.IsEmpty();
- bool bDragLimit=IsDragLimit();
+ tools::Rectangle aSR2(GetMarkedRect());
+ Point aD(aPt1-DragStat().GetStart());
- if (bDragLimit || bWorkArea)
+ if (bDragLimit)
{
- tools::Rectangle aSR2(GetMarkedRect());
- Point aD(aPt1-DragStat().GetStart());
-
- if (bDragLimit)
- {
- tools::Rectangle aR2(GetDragLimitRect());
+ tools::Rectangle aR2(GetDragLimitRect());
- if (bWorkArea)
- aLR.Intersection(aR2);
- else
- aLR=aR2;
- }
+ if (bWorkArea)
+ aLR.Intersection(aR2);
+ else
+ aLR=aR2;
+ }
- if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
- { // any space to move to?
- aSR2.Move(aD.X(),0);
+ if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
+ { // any space to move to?
+ aSR2.Move(aD.X(),0);
- if (aSR2.Left()<aLR.Left())
- {
- aPt1.AdjustX( -(aSR2.Left()-aLR.Left()) );
- }
- else if (aSR2.Right()>aLR.Right())
- {
- aPt1.AdjustX( -(aSR2.Right()-aLR.Right()) );
- }
+ if (aSR2.Left()<aLR.Left())
+ {
+ aPt1.AdjustX( -(aSR2.Left()-aLR.Left()) );
}
- else
- aPt1.setX(DragStat().GetStart().X() ); // no space to move to
+ else if (aSR2.Right()>aLR.Right())
+ {
+ aPt1.AdjustX( -(aSR2.Right()-aLR.Right()) );
+ }
+ }
+ else
+ aPt1.setX(DragStat().GetStart().X() ); // no space to move to
- if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
- { // any space to move to?
- aSR2.Move(0,aD.Y());
+ if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
+ { // any space to move to?
+ aSR2.Move(0,aD.Y());
- if (aSR2.Top()<aLR.Top())
- {
- aPt1.AdjustY( -(aSR2.Top()-aLR.Top()) );
- }
- else if (aSR2.Bottom()>aLR.Bottom())
- {
- aPt1.AdjustY( -(aSR2.Bottom()-aLR.Bottom()) );
- }
+ if (aSR2.Top()<aLR.Top())
+ {
+ aPt1.AdjustY( -(aSR2.Top()-aLR.Top()) );
+ }
+ else if (aSR2.Bottom()>aLR.Bottom())
+ {
+ aPt1.AdjustY( -(aSR2.Bottom()-aLR.Bottom()) );
}
- else
- aPt1.setY(DragStat().GetStart().Y() ); // no space to move to
}
+ else
+ aPt1.setY(DragStat().GetStart().Y() ); // no space to move to
+ }
+
+ if (getSdrDragView().IsDraggingGluePoints())
+ { // restrict glue points to the BoundRect of the Obj
+ aPt1-=DragStat().GetStart();
+ const SdrMarkList& rML=GetMarkedObjectList();
+ const size_t nMarkCount=rML.GetMarkCount();
- if (getSdrDragView().IsDraggingGluePoints())
- { // restrict glue points to the BoundRect of the Obj
- aPt1-=DragStat().GetStart();
- const SdrMarkList& rML=GetMarkedObjectList();
- const size_t nMarkCount=rML.GetMarkCount();
+ for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
+ {
+ const SdrMark* pM=rML.GetMark(nMarkNum);
+ const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
- for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
+ if (!rPts.empty())
{
- const SdrMark* pM=rML.GetMark(nMarkNum);
- const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrGluePointList* pGPL=pObj->GetGluePointList();
+ tools::Rectangle aBound(pObj->GetCurrentBoundRect());
- if (!rPts.empty())
+ for (sal_uInt16 nId : rPts)
{
- const SdrObject* pObj=pM->GetMarkedSdrObj();
- const SdrGluePointList* pGPL=pObj->GetGluePointList();
- tools::Rectangle aBound(pObj->GetCurrentBoundRect());
+ sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
- for (sal_uInt16 nId : rPts)
+ if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
{
- sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
-
- if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
- {
- Point aPt((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
- aPt+=aPt1; // move by this much
- if (aPt.X()<aBound.Left() ) aPt1.AdjustX( -(aPt.X()-aBound.Left()) ) ;
- if (aPt.X()>aBound.Right() ) aPt1.AdjustX( -(aPt.X()-aBound.Right()) ) ;
- if (aPt.Y()<aBound.Top() ) aPt1.AdjustY( -(aPt.Y()-aBound.Top()) ) ;
- if (aPt.Y()>aBound.Bottom()) aPt1.AdjustY( -(aPt.Y()-aBound.Bottom()) );
- }
+ Point aPt((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
+ aPt+=aPt1; // move by this much
+ if (aPt.X()<aBound.Left() ) aPt1.AdjustX( -(aPt.X()-aBound.Left()) ) ;
+ if (aPt.X()>aBound.Right() ) aPt1.AdjustX( -(aPt.X()-aBound.Right()) ) ;
+ if (aPt.Y()<aBound.Top() ) aPt1.AdjustY( -(aPt.Y()-aBound.Top()) ) ;
+ if (aPt.Y()>aBound.Bottom()) aPt1.AdjustY( -(aPt.Y()-aBound.Bottom()) );
}
}
}
-
- aPt1+=DragStat().GetStart();
}
- if (bOrtho)
- OrthoDistance8(DragStat().GetStart(),aPt1,false);
+ aPt1+=DragStat().GetStart();
+ }
- if (aPt1!=DragStat().GetNow())
- {
- Hide();
- DragStat().NextMove(aPt1);
- tools::Rectangle aAction(GetMarkedRect());
- aAction.Move(DragStat().GetDX(),DragStat().GetDY());
- DragStat().SetActionRect(aAction);
- Show();
- }
+ if (bOrtho)
+ OrthoDistance8(DragStat().GetStart(),aPt1,false);
+
+ if (aPt1!=DragStat().GetNow())
+ {
+ Hide();
+ DragStat().NextMove(aPt1);
+ tools::Rectangle aAction(GetMarkedRect());
+ aAction.Move(DragStat().GetDX(),DragStat().GetDY());
+ DragStat().SetActionRect(aAction);
+ Show();
}
}
@@ -2114,48 +2114,48 @@ basegfx::B2DHomMatrix SdrDragRotate::getCurrentTransformation()
void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
{
Point aPnt(rPnt_);
- if (DragStat().CheckMinMoved(aPnt))
- {
- long nNewAngle=NormAngle36000(GetAngle(aPnt-DragStat().GetRef1())-nAngle0);
- long nSA=0;
+ if (!DragStat().CheckMinMoved(aPnt))
+ return;
- if (getSdrDragView().IsAngleSnapEnabled())
- nSA=getSdrDragView().GetSnapAngle();
+ long nNewAngle=NormAngle36000(GetAngle(aPnt-DragStat().GetRef1())-nAngle0);
+ long nSA=0;
- if (!getSdrDragView().IsRotateAllowed())
- nSA=9000;
+ if (getSdrDragView().IsAngleSnapEnabled())
+ nSA=getSdrDragView().GetSnapAngle();
- if (nSA!=0)
- { // angle snapping
- nNewAngle+=nSA/2;
- nNewAngle/=nSA;
- nNewAngle*=nSA;
- }
+ if (!getSdrDragView().IsRotateAllowed())
+ nSA=9000;
- nNewAngle=NormAngle18000(nNewAngle);
+ if (nSA!=0)
+ { // angle snapping
+ nNewAngle+=nSA/2;
+ nNewAngle/=nSA;
+ nNewAngle*=nSA;
+ }
- if (nAngle!=nNewAngle)
- {
- sal_uInt16 nSekt0=GetAngleSector(nAngle);
- sal_uInt16 nSekt1=GetAngleSector(nNewAngle);
+ nNewAngle=NormAngle18000(nNewAngle);
- if (nSekt0==0 && nSekt1==3)
- bRight=true;
+ if (nAngle==nNewAngle)
+ return;
- if (nSekt0==3 && nSekt1==0)
- bRight=false;
+ sal_uInt16 nSekt0=GetAngleSector(nAngle);
+ sal_uInt16 nSekt1=GetAngleSector(nNewAngle);
- nAngle=nNewAngle;
- double a = nAngle * F_PI18000;
- double nSin1=sin(a); // calculate now, so as little time as possible
- double nCos1=cos(a); // passes between Hide() and Show()
- Hide();
- nSin=nSin1;
- nCos=nCos1;
- DragStat().NextMove(aPnt);
- Show();
- }
- }
+ if (nSekt0==0 && nSekt1==3)
+ bRight=true;
+
+ if (nSekt0==3 && nSekt1==0)
+ bRight=false;
+
+ nAngle=nNewAngle;
+ double a = nAngle * F_PI18000;
+ double nSin1=sin(a); // calculate now, so as little time as possible
+ double nCos1=cos(a); // passes between Hide() and Show()
+ Hide();
+ nSin=nSin1;
+ nCos=nCos1;
+ DragStat().NextMove(aPnt);
+ Show();
}
bool SdrDragRotate::EndSdrDrag(bool bCopy)
@@ -2559,18 +2559,18 @@ basegfx::B2DHomMatrix SdrDragMirror::getCurrentTransformation()
void SdrDragMirror::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
- {
- bool bNewSide=ImpCheckSide(rPnt);
- bool bNewMirrored=bSide0!=bNewSide;
+ if (!DragStat().CheckMinMoved(rPnt))
+ return;
- if (bMirrored!=bNewMirrored)
- {
- Hide();
- bMirrored=bNewMirrored;
- DragStat().NextMove(rPnt);
- Show();
- }
+ bool bNewSide=ImpCheckSide(rPnt);
+ bool bNewMirrored=bSide0!=bNewSide;
+
+ if (bMirrored!=bNewMirrored)
+ {
+ Hide();
+ bMirrored=bNewMirrored;
+ DragStat().NextMove(rPnt);
+ Show();
}
}
@@ -2678,43 +2678,43 @@ bool SdrDragGradient::BeginSdrDrag()
void SdrDragGradient::MoveSdrDrag(const Point& rPnt)
{
- if(pIAOHandle && DragStat().CheckMinMoved(rPnt))
- {
- DragStat().NextMove(rPnt);
+ if(!(pIAOHandle && DragStat().CheckMinMoved(rPnt)))
+ return;
+
+ DragStat().NextMove(rPnt);
- // Do the Move here!!! DragStat().GetStart()
- Point aMoveDiff = rPnt - DragStat().GetStart();
+ // Do the Move here!!! DragStat().GetStart()
+ Point aMoveDiff = rPnt - DragStat().GetStart();
- if(pIAOHandle->IsMoveSingleHandle())
+ if(pIAOHandle->IsMoveSingleHandle())
+ {
+ if(pIAOHandle->IsMoveFirstHandle())
{
- if(pIAOHandle->IsMoveFirstHandle())
- {
- pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
- if(pIAOHandle->GetColorHdl1())
- pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
- }
- else
- {
- pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
- if(pIAOHandle->GetColorHdl2())
- pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
- }
+ pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
+ if(pIAOHandle->GetColorHdl1())
+ pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
}
else
{
- pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
-
- if(pIAOHandle->GetColorHdl1())
- pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
-
if(pIAOHandle->GetColorHdl2())
pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
}
+ }
+ else
+ {
+ pIAOHandle->SetPos(DragStat().GetRef1() + aMoveDiff);
+ pIAOHandle->Set2ndPos(DragStat().GetRef2() + aMoveDiff);
+
+ if(pIAOHandle->GetColorHdl1())
+ pIAOHandle->GetColorHdl1()->SetPos(DragStat().GetRef1() + aMoveDiff);
- // new state
- pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false);
+ if(pIAOHandle->GetColorHdl2())
+ pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2() + aMoveDiff);
}
+
+ // new state
+ pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false);
}
bool SdrDragGradient::EndSdrDrag(bool /*bCopy*/)
@@ -2918,117 +2918,117 @@ void SdrDragCrook::MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
{
SdrPageView* pPV = getSdrDragView().GetSdrPageView();
- if(pPV)
+ if(!pPV)
+ return;
+
+ XPolyPolygon aTempPolyPoly(rTarget);
+
+ if (pPV->HasMarkedObjPageView())
{
- XPolyPolygon aTempPolyPoly(rTarget);
+ sal_uInt16 nPolyCount=aTempPolyPoly.Count();
- if (pPV->HasMarkedObjPageView())
+ if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
{
- sal_uInt16 nPolyCount=aTempPolyPoly.Count();
+ sal_uInt16 n1st=0,nLast=0;
+ Point aC(aCenter);
- if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
+ while (n1st<nPolyCount)
{
- sal_uInt16 n1st=0,nLast=0;
- Point aC(aCenter);
+ nLast=n1st;
+ while (nLast<nPolyCount && aTempPolyPoly[nLast].GetPointCount()!=0) nLast++;
+ tools::Rectangle aBound(aTempPolyPoly[n1st].GetBoundRect());
+ sal_uInt16 i;
- while (n1st<nPolyCount)
+ for (i=n1st+1; i<nLast; i++)
{
- nLast=n1st;
- while (nLast<nPolyCount && aTempPolyPoly[nLast].GetPointCount()!=0) nLast++;
- tools::Rectangle aBound(aTempPolyPoly[n1st].GetBoundRect());
- sal_uInt16 i;
+ aBound.Union(aTempPolyPoly[n1st].GetBoundRect());
+ }
- for (i=n1st+1; i<nLast; i++)
- {
- aBound.Union(aTempPolyPoly[n1st].GetBoundRect());
- }
+ Point aCtr0(aBound.Center());
+ Point aCtr1(aCtr0);
- Point aCtr0(aBound.Center());
- Point aCtr1(aCtr0);
+ if (bResize)
+ {
+ Fraction aFact1(1,1);
- if (bResize)
+ if (bVertical)
{
- Fraction aFact1(1,1);
-
- if (bVertical)
- {
- ResizePoint(aCtr1,aC,aFact1,aFact);
- }
- else
- {
- ResizePoint(aCtr1,aC,aFact,aFact1);
- }
+ ResizePoint(aCtr1,aC,aFact1,aFact);
}
-
- bool bRotOk=false;
- double nSin=0,nCos=0;
-
- if (aRad.X()!=0 && aRad.Y()!=0)
+ else
{
- bRotOk=bRotate;
-
- switch (eMode)
- {
- case SdrCrookMode::Rotate : CrookRotateXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
- case SdrCrookMode::Slant : CrookSlantXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
- case SdrCrookMode::Stretch: CrookStretchXPoint(aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical,aMarkRect); break;
- } // switch
+ ResizePoint(aCtr1,aC,aFact,aFact1);
}
+ }
- aCtr1-=aCtr0;
+ bool bRotOk=false;
+ double nSin=0,nCos=0;
- for (i=n1st; i<nLast; i++)
+ if (aRad.X()!=0 && aRad.Y()!=0)
+ {
+ bRotOk=bRotate;
+
+ switch (eMode)
{
- if (bRotOk)
- {
- RotateXPoly(aTempPolyPoly[i],aCtr0,nSin,nCos);
- }
+ case SdrCrookMode::Rotate : CrookRotateXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
+ case SdrCrookMode::Slant : CrookSlantXPoint (aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical); break;
+ case SdrCrookMode::Stretch: CrookStretchXPoint(aCtr1,nullptr,nullptr,aC,aRad,nSin,nCos,bVertical,aMarkRect); break;
+ } // switch
+ }
+
+ aCtr1-=aCtr0;
- aTempPolyPoly[i].Move(aCtr1.X(),aCtr1.Y());
+ for (i=n1st; i<nLast; i++)
+ {
+ if (bRotOk)
+ {
+ RotateXPoly(aTempPolyPoly[i],aCtr0,nSin,nCos);
}
- n1st=nLast+1;
+ aTempPolyPoly[i].Move(aCtr1.X(),aCtr1.Y());
}
+
+ n1st=nLast+1;
}
- else
+ }
+ else
+ {
+ sal_uInt16 i,j;
+
+ for (j=0; j<nPolyCount; j++)
{
- sal_uInt16 i,j;
+ XPolygon& aPol=aTempPolyPoly[j];
+ sal_uInt16 nPointCount=aPol.GetPointCount();
+ i=0;
- for (j=0; j<nPolyCount; j++)
+ while (i<nPointCount)
{
- XPolygon& aPol=aTempPolyPoly[j];
- sal_uInt16 nPointCount=aPol.GetPointCount();
- i=0;
-
- while (i<nPointCount)
- {
- Point* pPnt=&aPol[i];
- Point* pC1=nullptr;
- Point* pC2=nullptr;
-
- if (i+1<nPointCount && aPol.IsControl(i))
- { // control point on the left
- pC1=pPnt;
- i++;
- pPnt=&aPol[i];
- }
+ Point* pPnt=&aPol[i];
+ Point* pC1=nullptr;
+ Point* pC2=nullptr;
+ if (i+1<nPointCount && aPol.IsControl(i))
+ { // control point on the left
+ pC1=pPnt;
i++;
+ pPnt=&aPol[i];
+ }
- if (i<nPointCount && aPol.IsControl(i))
- { // control point on the right
- pC2=&aPol[i];
- i++;
- }
+ i++;
- MovCrookPoint(*pPnt,pC1,pC2);
+ if (i<nPointCount && aPol.IsControl(i))
+ { // control point on the right
+ pC2=&aPol[i];
+ i++;
}
+
+ MovCrookPoint(*pPnt,pC1,pC2);
}
}
}
-
- rTarget = aTempPolyPoly.getB2DPolyPolygon();
}
+
+ rTarget = aTempPolyPoly.getB2DPolyPolygon();
}
void SdrDragCrook::MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
@@ -3245,50 +3245,50 @@ void SdrDragCrook::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
const bool bDoResize(aFact!=Fraction(1,1));
const bool bDoCrook(aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0);
- if (bDoCrook || bDoResize)
+ if (!(bDoCrook || bDoResize))
+ return;
+
+ if (bDoResize)
{
- if (bDoResize)
- {
- Fraction aFact1(1,1);
+ Fraction aFact1(1,1);
- if (bContortion)
+ if (bContortion)
+ {
+ if (bVertical)
{
- if (bVertical)
- {
- rTarget.Resize(aCenter,aFact1,aFact);
- }
- else
- {
- rTarget.Resize(aCenter,aFact,aFact1);
- }
+ rTarget.Resize(aCenter,aFact1,aFact);
}
else
{
- Point aCtr0(rTarget.GetSnapRect().Center());
- Point aCtr1(aCtr0);
+ rTarget.Resize(aCenter,aFact,aFact1);
+ }
+ }
+ else
+ {
+ Point aCtr0(rTarget.GetSnapRect().Center());
+ Point aCtr1(aCtr0);
- if (bVertical)
- {
- ResizePoint(aCtr1,aCenter,aFact1,aFact);
- }
- else
- {
- ResizePoint(aCtr1,aCenter,aFact,aFact1);
- }
+ if (bVertical)
+ {
+ ResizePoint(aCtr1,aCenter,aFact1,aFact);
+ }
+ else
+ {
+ ResizePoint(aCtr1,aCenter,aFact,aFact1);
+ }
- Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
+ Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
- rTarget.Move(aSiz);
- }
+ rTarget.Move(aSiz);
}
+ }
- if (bDoCrook)
- {
- const tools::Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
- const bool bLocalRotate(!bContortion && eMode == SdrCrookMode::Rotate && getSdrDragView().IsRotateAllowed());
+ if (bDoCrook)
+ {
+ const tools::Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
+ const bool bLocalRotate(!bContortion && eMode == SdrCrookMode::Rotate && getSdrDragView().IsRotateAllowed());
- SdrEditView::ImpCrookObj(&rTarget,aCenter,aRad,eMode,bVertical,!bContortion,bLocalRotate,aLocalMarkRect);
- }
+ SdrEditView::ImpCrookObj(&rTarget,aCenter,aRad,eMode,bVertical,!bContortion,bLocalRotate,aLocalMarkRect);
}
}
@@ -3450,44 +3450,44 @@ bool SdrDragDistort::BeginSdrDrag()
void SdrDragDistort::MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
{
- if (bContortion)
- {
- SdrPageView* pPV = getSdrDragView().GetSdrPageView();
+ if (!bContortion)
+ return;
- if(pPV && pPV->HasMarkedObjPageView())
- {
- basegfx::B2DPolyPolygon aDragPolygon(rTarget);
- const basegfx::B2DRange aOriginalRange = vcl::unotools::b2DRectangleFromRectangle(aMarkRect);
- const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
- const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
- const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
- const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
+ SdrPageView* pPV = getSdrDragView().GetSdrPageView();
- aDragPolygon = basegfx::utils::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
- rTarget = aDragPolygon;
- }
+ if(pPV && pPV->HasMarkedObjPageView())
+ {
+ basegfx::B2DPolyPolygon aDragPolygon(rTarget);
+ const basegfx::B2DRange aOriginalRange = vcl::unotools::b2DRectangleFromRectangle(aMarkRect);
+ const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
+ const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
+ const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
+ const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
+
+ aDragPolygon = basegfx::utils::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
+ rTarget = aDragPolygon;
}
}
void SdrDragDistort::MoveSdrDrag(const Point& rPnt)
{
- if (DragStat().CheckMinMoved(rPnt))
- {
- Point aPnt(GetSnapPos(rPnt));
+ if (!DragStat().CheckMinMoved(rPnt))
+ return;
- if (getSdrDragView().IsOrtho())
- OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
+ Point aPnt(GetSnapPos(rPnt));
- bool bNewContortion=(bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed;
+ if (getSdrDragView().IsOrtho())
+ OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
- if (bNewContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
- {
- Hide();
- aDistortedRect[nPolyPt]=aPnt;
- bContortion=bNewContortion;
- DragStat().NextMove(aPnt);
- Show();
- }
+ bool bNewContortion=(bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed;
+
+ if (bNewContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
+ {
+ Hide();
+ aDistortedRect[nPolyPt]=aPnt;
+ bContortion=bNewContortion;
+ DragStat().NextMove(aPnt);
+ Show();
}
}
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 7002f9447d0d..0be9b5786cb7 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -513,25 +513,25 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl
void SdrDragView::MovDragObj(const Point& rPnt)
{
- if (mpCurrentSdrDragMethod)
+ if (!mpCurrentSdrDragMethod)
+ return;
+
+ Point aPnt(rPnt);
+ basegfx::B2DVector aGridOffset(0.0, 0.0);
+
+ // Coordinate maybe affected by GridOffset, so we may need to
+ // adapt to Model-coordinates here
+ if(getPossibleGridOffsetForPosition(
+ aGridOffset,
+ basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
+ GetSdrPageView()))
{
- Point aPnt(rPnt);
- basegfx::B2DVector aGridOffset(0.0, 0.0);
-
- // Coordinate maybe affected by GridOffset, so we may need to
- // adapt to Model-coordinates here
- if(getPossibleGridOffsetForPosition(
- aGridOffset,
- basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
- GetSdrPageView()))
- {
- aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
- aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
- }
-
- ImpLimitToWorkArea(aPnt);
- mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
+ aPnt.AdjustX(basegfx::fround(-aGridOffset.getX()));
+ aPnt.AdjustY(basegfx::fround(-aGridOffset.getY()));
}
+
+ ImpLimitToWorkArea(aPnt);
+ mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
}
bool SdrDragView::EndDragObj(bool bCopy)
@@ -607,32 +607,32 @@ bool SdrDragView::EndDragObj(bool bCopy)
void SdrDragView::BrkDragObj()
{
- if (mpCurrentSdrDragMethod)
- {
- mpCurrentSdrDragMethod->CancelSdrDrag();
+ if (!mpCurrentSdrDragMethod)
+ return;
- mpCurrentSdrDragMethod.reset();
+ mpCurrentSdrDragMethod->CancelSdrDrag();
- if (mbInsPolyPoint)
- {
- mpInsPointUndo->Undo(); // delete inserted point again
- delete mpInsPointUndo;
- mpInsPointUndo=nullptr;
- SetMarkHandles(nullptr);
- mbInsPolyPoint=false;
- }
+ mpCurrentSdrDragMethod.reset();
- if (IsInsertGluePoint())
- {
- mpInsPointUndo->Undo(); // delete inserted glue point again
- delete mpInsPointUndo;
- mpInsPointUndo=nullptr;
- SetInsertGluePoint(false);
- }
+ if (mbInsPolyPoint)
+ {
+ mpInsPointUndo->Undo(); // delete inserted point again
+ delete mpInsPointUndo;
+ mpInsPointUndo=nullptr;
+ SetMarkHandles(nullptr);
+ mbInsPolyPoint=false;
+ }
- meDragHdl=SdrHdlKind::Move;
- mpDragHdl=nullptr;
+ if (IsInsertGluePoint())
+ {
+ mpInsPointUndo->Undo(); // delete inserted glue point again
+ delete mpInsPointUndo;
+ mpInsPointUndo=nullptr;
+ SetInsertGluePoint(false);
}
+
+ meDragHdl=SdrHdlKind::Move;
+ mpDragHdl=nullptr;
}
bool SdrDragView::IsInsObjPointPossible() const
@@ -799,42 +799,42 @@ bool SdrDragView::BegInsGluePoint(const Point& rPnt)
void SdrDragView::ShowDragObj()
{
- if(mpCurrentSdrDragMethod && !maDragStat.IsShown())
+ if(!(mpCurrentSdrDragMethod && !maDragStat.IsShown()))
+ return;
+
+ // Changed for the GridOffset stuff: No longer iterate over
+ // SdrPaintWindow(s), but now over SdrPageWindow(s), so doing the
+ // same as the SdrHdl visualizations (see ::CreateB2dIAObject) do.
+ // This is needed to get access to an ObjectContact which is needed
+ // to evtl. process that GridOffset in CreateOverlayGeometry
+ SdrPageView* pPageView(GetSdrPageView());
+
+ if(nullptr != pPageView)
{
- // Changed for the GridOffset stuff: No longer iterate over
- // SdrPaintWindow(s), but now over SdrPageWindow(s), so doing the
- // same as the SdrHdl visualizations (see ::CreateB2dIAObject) do.
- // This is needed to get access to an ObjectContact which is needed
- // to evtl. process that GridOffset in CreateOverlayGeometry
- SdrPageView* pPageView(GetSdrPageView());
-
- if(nullptr != pPageView)
+ for(sal_uInt32 a(0); a < pPageView->PageWindowCount(); a++)
{
- for(sal_uInt32 a(0); a < pPageView->PageWindowCount(); a++)
+ const SdrPageWindow& rPageWindow(*pPageView->GetPageWindow(a));
+ const SdrPaintWindow& rPaintWindow(rPageWindow.GetPaintWindow());
+
+ if(rPaintWindow.OutputToWindow())
{
- const SdrPageWindow& rPageWindow(*pPageView->GetPageWindow(a));
- const SdrPaintWindow& rPaintWindow(rPageWindow.GetPaintWindow());
+ const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager(
+ rPaintWindow.GetOverlayManager());
- if(rPaintWindow.OutputToWindow())
+ if(xOverlayManager.is())
{
- const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager(
- rPaintWindow.GetOverlayManager());
-
- if(xOverlayManager.is())
- {
- mpCurrentSdrDragMethod->CreateOverlayGeometry(
- *xOverlayManager,
- rPageWindow.GetObjectContact());
+ mpCurrentSdrDragMethod->CreateOverlayGeometry(
+ *xOverlayManager,
+ rPageWindow.GetObjectContact());
- // #i101679# Force changed overlay to be shown
- xOverlayManager->flush();
- }
+ // #i101679# Force changed overlay to be shown
+ xOverlayManager->flush();
}
}
}
-
- maDragStat.SetShown(true);
}
+
+ maDragStat.SetShown(true);
}
void SdrDragView::HideDragObj()
@@ -849,28 +849,28 @@ void SdrDragView::HideDragObj()
void SdrDragView::SetNoDragXorPolys(bool bOn)
{
- if (IsNoDragXorPolys()!=bOn)
- {
- const bool bDragging(mpCurrentSdrDragMethod);
- const bool bShown(bDragging && maDragStat.IsShown());
+ if (IsNoDragXorPolys()==bOn)
+ return;
- if(bShown)
- {
- HideDragObj();
- }
+ const bool bDragging(mpCurrentSdrDragMethod);
+ const bool bShown(bDragging && maDragStat.IsShown());
- mbNoDragXorPolys = bOn;
+ if(bShown)
+ {
+ HideDragObj();
+ }
- if(bDragging)
- {
- // force recreation of drag content
- mpCurrentSdrDragMethod->resetSdrDragEntries();
- }
+ mbNoDragXorPolys = bOn;
- if(bShown)
- {
- ShowDragObj();
- }
+ if(bDragging)
+ {
+ // force recreation of drag content
+ mpCurrentSdrDragMethod->resetSdrDragEntries();
+ }
+
+ if(bShown)
+ {
+ ShowDragObj();
}
}
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 2e63c58d32b4..34b7c58c25b3 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -192,83 +192,83 @@ void SdrEditView::DeleteLayer(const OUString& rName)
SdrLayerAdmin& rLA = mpModel->GetLayerAdmin();
SdrLayer* pLayer = rLA.GetLayer(rName);
- if(pLayer)
- {
- sal_uInt16 nLayerNum(rLA.GetLayerPos(pLayer));
- SdrLayerID nDelID = pLayer->GetID();
+ if(!pLayer)
+ return;
- const bool bUndo = IsUndoEnabled();
- if( bUndo )
- BegUndo(SvxResId(STR_UndoDelLayer));
+ sal_uInt16 nLayerNum(rLA.GetLayerPos(pLayer));
+ SdrLayerID nDelID = pLayer->GetID();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(SvxResId(STR_UndoDelLayer));
+
+ bool bMaPg(true);
- bool bMaPg(true);
+ for(sal_uInt16 nPageKind(0); nPageKind < 2; nPageKind++)
+ {
+ // MasterPages and DrawPages
+ sal_uInt16 nPgCount(bMaPg ? mpModel->GetMasterPageCount() : mpModel->GetPageCount());
- for(sal_uInt16 nPageKind(0); nPageKind < 2; nPageKind++)
+ for(sal_uInt16 nPgNum(0); nPgNum < nPgCount; nPgNum++)
{
- // MasterPages and DrawPages
- sal_uInt16 nPgCount(bMaPg ? mpModel->GetMasterPageCount() : mpModel->GetPageCount());
+ // over all pages
+ SdrPage* pPage = bMaPg ? mpModel->GetMasterPage(nPgNum) : mpModel->GetPage(nPgNum);
+ const size_t nObjCount(pPage->GetObjCount());
- for(sal_uInt16 nPgNum(0); nPgNum < nPgCount; nPgNum++)
- {
- // over all pages
- SdrPage* pPage = bMaPg ? mpModel->GetMasterPage(nPgNum) : mpModel->GetPage(nPgNum);
- const size_t nObjCount(pPage->GetObjCount());
+ // make sure OrdNums are correct
+ if(nObjCount)
+ pPage->GetObj(0)->GetOrdNum();
- // make sure OrdNums are correct
- if(nObjCount)
- pPage->GetObj(0)->GetOrdNum();
+ for(size_t nObjNum(nObjCount); nObjNum > 0;)
+ {
+ nObjNum--;
+ SdrObject* pObj = pPage->GetObj(nObjNum);
+ SdrObjList* pSubOL = pObj->GetSubList();
- for(size_t nObjNum(nObjCount); nObjNum > 0;)
+ // explicitly test for group objects and 3d scenes
+ if(pSubOL && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr || dynamic_cast<const E3dScene* >(pObj) != nullptr))
{
- nObjNum--;
- SdrObject* pObj = pPage->GetObj(nObjNum);
- SdrObjList* pSubOL = pObj->GetSubList();
-
- // explicitly test for group objects and 3d scenes
- if(pSubOL && (dynamic_cast<const SdrObjGroup*>(pObj) != nullptr || dynamic_cast<const E3dScene* >(pObj) != nullptr))
+ if(ImpDelLayerCheck(pSubOL, nDelID))
{
- if(ImpDelLayerCheck(pSubOL, nDelID))
- {
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
- pPage->RemoveObject(nObjNum);
- if( !bUndo )
- SdrObject::Free(pObj);
- }
- else
- {
- ImpDelLayerDelObjs(pSubOL, nDelID);
- }
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
+ pPage->RemoveObject(nObjNum);
+ if( !bUndo )
+ SdrObject::Free(pObj);
}
else
{
- if(pObj->GetLayer() == nDelID)
- {
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
- pPage->RemoveObject(nObjNum);
- if( !bUndo )
- SdrObject::Free(pObj);
- }
+ ImpDelLayerDelObjs(pSubOL, nDelID);
+ }
+ }
+ else
+ {
+ if(pObj->GetLayer() == nDelID)
+ {
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true));
+ pPage->RemoveObject(nObjNum);
+ if( !bUndo )
+ SdrObject::Free(pObj);
}
}
}
- bMaPg = false;
- }
-
- if( bUndo )
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, *mpModel));
- rLA.RemoveLayer(nLayerNum).release();
- EndUndo();
- }
- else
- {
- rLA.RemoveLayer(nLayerNum);
}
+ bMaPg = false;
+ }
- mpModel->SetChanged();
+ if( bUndo )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, *mpModel));
+ rLA.RemoveLayer(nLayerNum).release();
+ EndUndo();
+ }
+ else
+ {
+ rLA.RemoveLayer(nLayerNum);
}
+
+ mpModel->SetChanged();
}
@@ -464,189 +464,189 @@ void SdrEditView::CheckPossibilities()
CheckMarked();
}
- if (m_bPossibilitiesDirty)
+ if (!m_bPossibilitiesDirty)
+ return;
+
+ ImpResetPossibilityFlags();
+ SortMarkedObjects();
+ const size_t nMarkCount = GetMarkedObjectCount();
+ if (nMarkCount != 0)
{
- ImpResetPossibilityFlags();
- SortMarkedObjects();
- const size_t nMarkCount = GetMarkedObjectCount();
- if (nMarkCount != 0)
- {
- m_bReverseOrderPossible = (nMarkCount >= 2);
+ m_bReverseOrderPossible = (nMarkCount >= 2);
- size_t nMovableCount=0;
- m_bGroupPossible=nMarkCount>=2;
- m_bCombinePossible=nMarkCount>=2;
- if (nMarkCount==1)
- {
- // check bCombinePossible more thoroughly
- // still missing ...
- const SdrObject* pObj=GetMarkedObjectByIndex(0);
- //const SdrPathObj* pPath=dynamic_cast<SdrPathObj*>( pObj );
- bool bGroup=pObj->GetSubList()!=nullptr;
- bool bHasText=pObj->GetOutlinerParaObject()!=nullptr;
- if (bGroup || bHasText) {
- m_bCombinePossible=true;
- }
+ size_t nMovableCount=0;
+ m_bGroupPossible=nMarkCount>=2;
+ m_bCombinePossible=nMarkCount>=2;
+ if (nMarkCount==1)
+ {
+ // check bCombinePossible more thoroughly
+ // still missing ...
+ const SdrObject* pObj=GetMarkedObjectByIndex(0);
+ //const SdrPathObj* pPath=dynamic_cast<SdrPathObj*>( pObj );
+ bool bGroup=pObj->GetSubList()!=nullptr;
+ bool bHasText=pObj->GetOutlinerParaObject()!=nullptr;
+ if (bGroup || bHasText) {
+ m_bCombinePossible=true;
}
- m_bCombineNoPolyPolyPossible=m_bCombinePossible;
- // accept transformations for now
- m_bMoveAllowed =true;
- m_bResizeFreeAllowed=true;
- m_bResizePropAllowed=true;
- m_bRotateFreeAllowed=true;
- m_bRotate90Allowed =true;
- m_bMirrorFreeAllowed=true;
- m_bMirror45Allowed =true;
- m_bMirror90Allowed =true;
- m_bShearAllowed =true;
- m_bEdgeRadiusAllowed=false;
- m_bContortionPossible=true;
- m_bCanConvToContour = true;
-
- // these ones are only allowed when single object is selected
- m_bTransparenceAllowed = (nMarkCount == 1);
- m_bGradientAllowed = (nMarkCount == 1);
- m_bCropAllowed = (nMarkCount == 1);
- if(m_bGradientAllowed)
- {
- // gradient depends on fill style
- const SdrMark* pM = GetSdrMarkByIndex(0);
- const SdrObject* pObj = pM->GetMarkedSdrObj();
+ }
+ m_bCombineNoPolyPolyPossible=m_bCombinePossible;
+ // accept transformations for now
+ m_bMoveAllowed =true;
+ m_bResizeFreeAllowed=true;
+ m_bResizePropAllowed=true;
+ m_bRotateFreeAllowed=true;
+ m_bRotate90Allowed =true;
+ m_bMirrorFreeAllowed=true;
+ m_bMirror45Allowed =true;
+ m_bMirror90Allowed =true;
+ m_bShearAllowed =true;
+ m_bEdgeRadiusAllowed=false;
+ m_bContortionPossible=true;
+ m_bCanConvToContour = true;
+
+ // these ones are only allowed when single object is selected
+ m_bTransparenceAllowed = (nMarkCount == 1);
+ m_bGradientAllowed = (nMarkCount == 1);
+ m_bCropAllowed = (nMarkCount == 1);
+ if(m_bGradientAllowed)
+ {
+ // gradient depends on fill style
+ const SdrMark* pM = GetSdrMarkByIndex(0);
+ const SdrObject* pObj = pM->GetMarkedSdrObj();
- // may be group object, so get merged ItemSet
- const SfxItemSet& rSet = pObj->GetMergedItemSet();
- SfxItemState eState = rSet.GetItemState(XATTR_FILLSTYLE, false);
+ // may be group object, so get merged ItemSet
+ const SfxItemSet& rSet = pObj->GetMergedItemSet();
+ SfxItemState eState = rSet.GetItemState(XATTR_FILLSTYLE, false);
- if(SfxItemState::DONTCARE != eState)
- {
- // If state is not DONTCARE, test the item
- drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue();
+ if(SfxItemState::DONTCARE != eState)
+ {
+ // If state is not DONTCARE, test the item
+ drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue();
- if(eFillStyle != drawing::FillStyle_GRADIENT)
- {
- m_bGradientAllowed = false;
- }
+ if(eFillStyle != drawing::FillStyle_GRADIENT)
+ {
+ m_bGradientAllowed = false;
}
}
+ }
- bool bNoMovRotFound=false;
- const SdrPageView* pPV0=nullptr;
+ bool bNoMovRotFound=false;
+ const SdrPageView* pPV0=nullptr;
- for (size_t nm=0; nm<nMarkCount; ++nm) {
- const SdrMark* pM=GetSdrMarkByIndex(nm);
- const SdrObject* pObj=pM->GetMarkedSdrObj();
- const SdrPageView* pPV=pM->GetPageView();
- if (pPV!=pPV0) {
- if (pPV->IsReadOnly()) m_bReadOnly=true;
- pPV0=pPV;
- }
+ for (size_t nm=0; nm<nMarkCount; ++nm) {
+ const SdrMark* pM=GetSdrMarkByIndex(nm);
+ const SdrObject* pObj=pM->GetMarkedSdrObj();
+ const SdrPageView* pPV=pM->GetPageView();
+ if (pPV!=pPV0) {
+ if (pPV->IsReadOnly()) m_bReadOnly=true;
+ pPV0=pPV;
+ }
- SdrObjTransformInfoRec aInfo;
- pObj->TakeObjInfo(aInfo);
- bool bMovPrt=pObj->IsMoveProtect();
- bool bSizPrt=pObj->IsResizeProtect();
- if (!bMovPrt && aInfo.bMoveAllowed) nMovableCount++; // count MovableObjs
- if (bMovPrt) m_bMoveProtect=true;
- if (bSizPrt) m_bResizeProtect=true;
-
- // not allowed when not allowed at one object
- if(!aInfo.bTransparenceAllowed)
- m_bTransparenceAllowed = false;
-
- // If one of these can't do something, none can
- if (!aInfo.bMoveAllowed ) m_bMoveAllowed =false;
- if (!aInfo.bResizeFreeAllowed) m_bResizeFreeAllowed=false;
- if (!aInfo.bResizePropAllowed) m_bResizePropAllowed=false;
- if (!aInfo.bRotateFreeAllowed) m_bRotateFreeAllowed=false;
- if (!aInfo.bRotate90Allowed ) m_bRotate90Allowed =false;
- if (!aInfo.bMirrorFreeAllowed) m_bMirrorFreeAllowed=false;
- if (!aInfo.bMirror45Allowed ) m_bMirror45Allowed =false;
- if (!aInfo.bMirror90Allowed ) m_bMirror90Allowed =false;
- if (!aInfo.bShearAllowed ) m_bShearAllowed =false;
- if (aInfo.bEdgeRadiusAllowed) m_bEdgeRadiusAllowed=true;
- if (aInfo.bNoContortion ) m_bContortionPossible=false;
- // For Crook with Contortion: all objects have to be
- // Movable and Rotatable, except for a maximum of 1 of them
- if (!m_bMoreThanOneNoMovRot) {
- if (!aInfo.bMoveAllowed || !aInfo.bResizeFreeAllowed) {
- m_bMoreThanOneNoMovRot=bNoMovRotFound;
- bNoMovRotFound=true;
- }
+ SdrObjTransformInfoRec aInfo;
+ pObj->TakeObjInfo(aInfo);
+ bool bMovPrt=pObj->IsMoveProtect();
+ bool bSizPrt=pObj->IsResizeProtect();
+ if (!bMovPrt && aInfo.bMoveAllowed) nMovableCount++; // count MovableObjs
+ if (bMovPrt) m_bMoveProtect=true;
+ if (bSizPrt) m_bResizeProtect=true;
+
+ // not allowed when not allowed at one object
+ if(!aInfo.bTransparenceAllowed)
+ m_bTransparenceAllowed = false;
+
+ // If one of these can't do something, none can
+ if (!aInfo.bMoveAllowed ) m_bMoveAllowed =false;
+ if (!aInfo.bResizeFreeAllowed) m_bResizeFreeAllowed=false;
+ if (!aInfo.bResizePropAllowed) m_bResizePropAllowed=false;
+ if (!aInfo.bRotateFreeAllowed) m_bRotateFreeAllowed=false;
+ if (!aInfo.bRotate90Allowed ) m_bRotate90Allowed =false;
+ if (!aInfo.bMirrorFreeAllowed) m_bMirrorFreeAllowed=false;
+ if (!aInfo.bMirror45Allowed ) m_bMirror45Allowed =false;
+ if (!aInfo.bMirror90Allowed ) m_bMirror90Allowed =false;
+ if (!aInfo.bShearAllowed ) m_bShearAllowed =false;
+ if (aInfo.bEdgeRadiusAllowed) m_bEdgeRadiusAllowed=true;
+ if (aInfo.bNoContortion ) m_bContortionPossible=false;
+ // For Crook with Contortion: all objects have to be
+ // Movable and Rotatable, except for a maximum of 1 of them
+ if (!m_bMoreThanOneNoMovRot) {
+ if (!aInfo.bMoveAllowed || !aInfo.bResizeFreeAllowed) {
+ m_bMoreThanOneNoMovRot=bNoMovRotFound;
+ bNoMovRotFound=true;
}
+ }
- // Must be resizable to allow cropping
- if (!aInfo.bResizeFreeAllowed && !aInfo.bResizePropAllowed)
- m_bCropAllowed = false;
+ // Must be resizable to allow cropping
+ if (!aInfo.bResizeFreeAllowed && !aInfo.bResizePropAllowed)
+ m_bCropAllowed = false;
- // if one member cannot be converted, no conversion is possible
- if(!aInfo.bCanConvToContour)
- m_bCanConvToContour = false;
+ // if one member cannot be converted, no conversion is possible
+ if(!aInfo.bCanConvToContour)
+ m_bCanConvToContour = false;
- // Ungroup
- if (!m_bUnGroupPossible) m_bUnGroupPossible=pObj->GetSubList()!=nullptr;
- // ConvertToCurve: If at least one can be converted, that is fine.
- if (aInfo.bCanConvToPath ) m_bCanConvToPath =true;
- if (aInfo.bCanConvToPoly ) m_bCanConvToPoly =true;
+ // Ungroup
+ if (!m_bUnGroupPossible) m_bUnGroupPossible=pObj->GetSubList()!=nullptr;
+ // ConvertToCurve: If at least one can be converted, that is fine.
+ if (aInfo.bCanConvToPath ) m_bCanConvToPath =true;
+ if (aInfo.bCanConvToPoly ) m_bCanConvToPoly =true;
- // Combine/Dismantle
- if(m_bCombinePossible)
- {
- m_bCombinePossible = ImpCanConvertForCombine(pObj);
- m_bCombineNoPolyPolyPossible = m_bCombinePossible;
- }
+ // Combine/Dismantle
+ if(m_bCombinePossible)
+ {
+ m_bCombinePossible = ImpCanConvertForCombine(pObj);
+ m_bCombineNoPolyPolyPossible = m_bCombinePossible;
+ }
- if (!m_bDismantlePossible) m_bDismantlePossible = ImpCanDismantle(pObj, false);
- if (!m_bDismantleMakeLinesPossible) m_bDismantleMakeLinesPossible = ImpCanDismantle(pObj, true);
- // check OrthoDesiredOnMarked
- if (!m_bOrthoDesiredOnMarked && !aInfo.bNoOrthoDesired) m_bOrthoDesiredOnMarked=true;
- // check ImportMtf
+ if (!m_bDismantlePossible) m_bDismantlePossible = ImpCanDismantle(pObj, false);
+ if (!m_bDismantleMakeLinesPossible) m_bDismantleMakeLinesPossible = ImpCanDismantle(pObj, true);
+ // check OrthoDesiredOnMarked
+ if (!m_bOrthoDesiredOnMarked && !aInfo.bNoOrthoDesired) m_bOrthoDesiredOnMarked=true;
+ // check ImportMtf
- if (!m_bImportMtfPossible)
+ if (!m_bImportMtfPossible)
+ {
+ const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
+ if (pSdrGrafObj != nullptr)
{
- const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj);
- if (pSdrGrafObj != nullptr)
- {
- if ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) ||
- pSdrGrafObj->isEmbeddedVectorGraphicData())
- {
- m_bImportMtfPossible = true;
- }
- }
-
- const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
- if (pSdrOle2Obj)
+ if ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) ||
+ pSdrGrafObj->isEmbeddedVectorGraphicData())
{
- m_bImportMtfPossible = pSdrOle2Obj->GetObjRef().is();
+ m_bImportMtfPossible = true;
}
}
- }
- m_bOneOrMoreMovable=nMovableCount!=0;
- m_bGrpEnterPossible=m_bUnGroupPossible;
- }
- ImpCheckToTopBtmPossible();
- static_cast<SdrPolyEditView*>(this)->ImpCheckPolyPossibilities();
- m_bPossibilitiesDirty=false;
-
- if (m_bReadOnly) {
- bool bTemp=m_bGrpEnterPossible;
- ImpResetPossibilityFlags();
- m_bReadOnly=true;
- m_bGrpEnterPossible=bTemp;
- }
- if (m_bMoveAllowed) {
- // Don't allow moving glued connectors.
- // Currently only implemented for single selection.
- if (nMarkCount==1) {
- SdrObject* pObj=GetMarkedObjectByIndex(0);
- SdrEdgeObj* pEdge=dynamic_cast<SdrEdgeObj*>( pObj );
- if (pEdge!=nullptr) {
- SdrObject* pNode1=pEdge->GetConnectedNode(true);
- SdrObject* pNode2=pEdge->GetConnectedNode(false);
- if (pNode1!=nullptr || pNode2!=nullptr) m_bMoveAllowed=false;
+ const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj);
+ if (pSdrOle2Obj)
+ {
+ m_bImportMtfPossible = pSdrOle2Obj->GetObjRef().is();
}
}
}
+
+ m_bOneOrMoreMovable=nMovableCount!=0;
+ m_bGrpEnterPossible=m_bUnGroupPossible;
+ }
+ ImpCheckToTopBtmPossible();
+ static_cast<SdrPolyEditView*>(this)->ImpCheckPolyPossibilities();
+ m_bPossibilitiesDirty=false;
+
+ if (m_bReadOnly) {
+ bool bTemp=m_bGrpEnterPossible;
+ ImpResetPossibilityFlags();
+ m_bReadOnly=true;
+ m_bGrpEnterPossible=bTemp;
+ }
+ if (!m_bMoveAllowed) return;
+
+ // Don't allow moving glued connectors.
+ // Currently only implemented for single selection.
+ if (nMarkCount==1) {
+ SdrObject* pObj=GetMarkedObjectByIndex(0);
+ SdrEdgeObj* pEdge=dynamic_cast<SdrEdgeObj*>( pObj );
+ if (pEdge!=nullptr) {
+ SdrObject* pNode1=pEdge->GetConnectedNode(true);
+ SdrObject* pNode2=pEdge->GetConnectedNode(false);
+ if (pNode1!=nullptr || pNode2!=nullptr) m_bMoveAllowed=false;
+ }
}
}
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 439dba1a6ebb..17311eb5ab6c 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -547,34 +547,34 @@ void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRa
bDone = true;
}
- if(!bDone)
+ if(bDone)
+ return;
+
+ // for all others or if bNoContortion
+ Point aCtr0(pO->GetSnapRect().Center());
+ Point aCtr1(aCtr0);
+ bool bRotOk(false);
+ double nSin(0.0), nCos(1.0);
+ double nAngle(0.0);
+
+ if(0 != rRad.X() && 0 != rRad.Y())
{
- // for all others or if bNoContortion
- Point aCtr0(pO->GetSnapRect().Center());
- Point aCtr1(aCtr0);
- bool bRotOk(false);
- double nSin(0.0), nCos(1.0);
- double nAngle(0.0);
-
- if(0 != rRad.X() && 0 != rRad.Y())
- {
- bRotOk = bRotate;
+ bRotOk = bRotate;
- switch (eMode)
- {
- case SdrCrookMode::Rotate : nAngle=CrookRotateXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); bRotOk=bRotate; break;
- case SdrCrookMode::Slant : nAngle=CrookSlantXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); break;
- case SdrCrookMode::Stretch: nAngle=CrookStretchXPoint(aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical,rMarkRect); break;
- }
+ switch (eMode)
+ {
+ case SdrCrookMode::Rotate : nAngle=CrookRotateXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); bRotOk=bRotate; break;
+ case SdrCrookMode::Slant : nAngle=CrookSlantXPoint (aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical); break;
+ case SdrCrookMode::Stretch: nAngle=CrookStretchXPoint(aCtr1,nullptr,nullptr,rRef,rRad,nSin,nCos,bVertical,rMarkRect); break;
}
+ }
- aCtr1 -= aCtr0;
+ aCtr1 -= aCtr0;
- if(bRotOk)
- pO->Rotate(aCtr0, FRound(nAngle / F_PI18000), nSin, nCos);
+ if(bRotOk)
+ pO->Rotate(aCtr0, FRound(nAngle / F_PI18000), nSin, nCos);
- pO->Move(Size(aCtr1.X(),aCtr1.Y()));
- }
+ pO->Move(Size(aCtr1.X(),aCtr1.Y()));
}
void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookMode eMode,
@@ -1279,36 +1279,36 @@ SfxStyleSheet* SdrEditView::GetStyleSheetFromMarked() const
void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr)
{
- if (AreObjectsMarked())
+ if (!AreObjectsMarked())
+ return;
+
+ const bool bUndo = IsUndoEnabled();
+
+ if( bUndo )
{
- const bool bUndo = IsUndoEnabled();
+ EndTextEditAllViews();
+ OUString aStr;
+ if (pStyleSheet!=nullptr)
+ aStr = ImpGetDescriptionString(STR_EditSetStylesheet);
+ else
+ aStr = ImpGetDescriptionString(STR_EditDelStylesheet);
+ BegUndo(aStr);
+ }
+ const size_t nMarkCount=GetMarkedObjectCount();
+ for (size_t nm=0; nm<nMarkCount; ++nm)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
if( bUndo )
{
- EndTextEditAllViews();
- OUString aStr;
- if (pStyleSheet!=nullptr)
- aStr = ImpGetDescriptionString(STR_EditSetStylesheet);
- else
- aStr = ImpGetDescriptionString(STR_EditDelStylesheet);
- BegUndo(aStr);
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj()));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true));
}
-
- const size_t nMarkCount=GetMarkedObjectCount();
- for (size_t nm=0; nm<nMarkCount; ++nm)
- {
- SdrMark* pM=GetSdrMarkByIndex(nm);
- if( bUndo )
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj()));
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true));
- }
- pM->GetMarkedSdrObj()->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
- }
-
- if( bUndo )
- EndUndo();
+ pM->GetMarkedSdrObj()->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
}
+
+ if( bUndo )
+ EndUndo();
}
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index de8c521b3119..92bfe93fed56 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -70,178 +70,178 @@ void SdrEditView::ObjOrderChanged(SdrObject* /*pObj*/, size_t /*nOldPos*/, size_
void SdrEditView::MovMarkedToTop()
{
const size_t nCount=GetMarkedObjectCount();
- if (nCount!=0)
- {
- const bool bUndo = IsUndoEnabled();
+ if (nCount==0)
+ return;
- if( bUndo )
- BegUndo(SvxResId(STR_EditMovToTop),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::MoveToTop);
+ const bool bUndo = IsUndoEnabled();
- SortMarkedObjects();
- for (size_t nm=0; nm<nCount; ++nm)
- { // All Ordnums have to be correct!
- GetMarkedObjectByIndex(nm)->GetOrdNum();
+ if( bUndo )
+ BegUndo(SvxResId(STR_EditMovToTop),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::MoveToTop);
+
+ 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();
+ SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
+ if (pOL!=pOL0)
+ {
+ nNewPos = pOL->GetObjCount()-1;
+ pOL0=pOL;
}
- bool bChg=false;
- SdrObjList* pOL0=nullptr;
- size_t nNewPos=0;
- for (size_t nm=nCount; nm>0;)
+ const size_t nNowPos = pObj->GetOrdNumDirect();
+ const tools::Rectangle& rBR=pObj->GetCurrentBoundRect();
+ size_t nCmpPos = nNowPos+1;
+ SdrObject* pMaxObj=GetMaxToTopObj(pObj);
+ if (pMaxObj!=nullptr)
{
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
- if (pOL!=pOL0)
+ size_t nMaxPos=pMaxObj->GetOrdNum();
+ if (nMaxPos!=0)
+ nMaxPos--;
+ if (nNewPos>nMaxPos)
+ nNewPos=nMaxPos; // neither go faster...
+ if (nNewPos<nNowPos)
+ nNewPos=nNowPos; // nor go in the other direction
+ }
+ bool bEnd=false;
+ while (nCmpPos<nNewPos && !bEnd)
+ {
+ SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
+ if (pCmpObj==nullptr)
{
- nNewPos = pOL->GetObjCount()-1;
- pOL0=pOL;
+ OSL_FAIL("MovMarkedToTop(): Reference object not found.");
+ bEnd=true;
}
- const size_t nNowPos = pObj->GetOrdNumDirect();
- const tools::Rectangle& rBR=pObj->GetCurrentBoundRect();
- size_t nCmpPos = nNowPos+1;
- SdrObject* pMaxObj=GetMaxToTopObj(pObj);
- if (pMaxObj!=nullptr)
+ else if (pCmpObj==pMaxObj)
{
- size_t nMaxPos=pMaxObj->GetOrdNum();
- if (nMaxPos!=0)
- nMaxPos--;
- if (nNewPos>nMaxPos)
- nNewPos=nMaxPos; // neither go faster...
- if (nNewPos<nNowPos)
- nNewPos=nNowPos; // nor go in the other direction
+ nNewPos=nCmpPos;
+ nNewPos--;
+ bEnd=true;
}
- bool bEnd=false;
- while (nCmpPos<nNewPos && !bEnd)
+ else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
{
- SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
- if (pCmpObj==nullptr)
- {
- OSL_FAIL("MovMarkedToTop(): Reference object not found.");
- bEnd=true;
- }
- else if (pCmpObj==pMaxObj)
- {
- nNewPos=nCmpPos;
- nNewPos--;
- bEnd=true;
- }
- else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
- {
- nNewPos=nCmpPos;
- bEnd=true;
- }
- else
- {
- nCmpPos++;
- }
+ nNewPos=nCmpPos;
+ bEnd=true;
}
- if (nNowPos!=nNewPos)
+ else
{
- bChg=true;
- pOL->SetObjectOrdNum(nNowPos,nNewPos);
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
- ObjOrderChanged(pObj,nNowPos,nNewPos);
+ nCmpPos++;
}
- nNewPos--;
}
+ if (nNowPos!=nNewPos)
+ {
+ bChg=true;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos--;
+ }
- if( bUndo )
- EndUndo();
+ if( bUndo )
+ EndUndo();
- if (bChg)
- MarkListHasChanged();
- }
+ if (bChg)
+ MarkListHasChanged();
}
void SdrEditView::MovMarkedToBtm()
{
const size_t nCount=GetMarkedObjectCount();
- if (nCount!=0)
- {
- const bool bUndo = IsUndoEnabled();
+ if (nCount==0)
+ return;
- if( bUndo )
- BegUndo(SvxResId(STR_EditMovToBtm),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::MoveToBottom);
+ const bool bUndo = IsUndoEnabled();
- SortMarkedObjects();
- for (size_t nm=0; nm<nCount; ++nm)
- { // All Ordnums have to be correct!
- GetMarkedObjectByIndex(nm)->GetOrdNum();
- }
+ if( bUndo )
+ BegUndo(SvxResId(STR_EditMovToBtm),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::MoveToBottom);
- bool bChg=false;
- SdrObjList* pOL0=nullptr;
- size_t nNewPos=0;
- for (size_t nm=0; nm<nCount; ++nm)
+ 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=0; nm<nCount; ++nm)
+ {
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
+ if (pOL!=pOL0)
{
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
- if (pOL!=pOL0)
+ nNewPos=0;
+ pOL0=pOL;
+ }
+ const size_t nNowPos = pObj->GetOrdNumDirect();
+ const tools::Rectangle& rBR=pObj->GetCurrentBoundRect();
+ size_t nCmpPos = nNowPos;
+ if (nCmpPos>0)
+ --nCmpPos;
+ SdrObject* pMaxObj=GetMaxToBtmObj(pObj);
+ if (pMaxObj!=nullptr)
+ {
+ const size_t nMinPos=pMaxObj->GetOrdNum()+1;
+ if (nNewPos<nMinPos)
+ nNewPos=nMinPos; // neither go faster...
+ if (nNewPos>nNowPos)
+ nNewPos=nNowPos; // nor go in the other direction
+ }
+ bool bEnd=false;
+ // nNewPos in this case is the "maximum" position
+ // the object may reach without going faster than the object before
+ // it (multiple selection).
+ while (nCmpPos>nNewPos && !bEnd)
+ {
+ SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
+ if (pCmpObj==nullptr)
{
- nNewPos=0;
- pOL0=pOL;
+ OSL_FAIL("MovMarkedToBtm(): Reference object not found.");
+ bEnd=true;
}
- const size_t nNowPos = pObj->GetOrdNumDirect();
- const tools::Rectangle& rBR=pObj->GetCurrentBoundRect();
- size_t nCmpPos = nNowPos;
- if (nCmpPos>0)
- --nCmpPos;
- SdrObject* pMaxObj=GetMaxToBtmObj(pObj);
- if (pMaxObj!=nullptr)
+ else if (pCmpObj==pMaxObj)
{
- const size_t nMinPos=pMaxObj->GetOrdNum()+1;
- if (nNewPos<nMinPos)
- nNewPos=nMinPos; // neither go faster...
- if (nNewPos>nNowPos)
- nNewPos=nNowPos; // nor go in the other direction
+ nNewPos=nCmpPos;
+ nNewPos++;
+ bEnd=true;
}
- bool bEnd=false;
- // nNewPos in this case is the "maximum" position
- // the object may reach without going faster than the object before
- // it (multiple selection).
- while (nCmpPos>nNewPos && !bEnd)
+ else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
{
- SdrObject* pCmpObj=pOL->GetObj(nCmpPos);
- if (pCmpObj==nullptr)
- {
- OSL_FAIL("MovMarkedToBtm(): Reference object not found.");
- bEnd=true;
- }
- else if (pCmpObj==pMaxObj)
- {
- nNewPos=nCmpPos;
- nNewPos++;
- bEnd=true;
- }
- else if (rBR.IsOver(pCmpObj->GetCurrentBoundRect()))
- {
- nNewPos=nCmpPos;
- bEnd=true;
- }
- else
- {
- nCmpPos--;
- }
+ nNewPos=nCmpPos;
+ bEnd=true;
}
- if (nNowPos!=nNewPos)
+ else
{
- bChg=true;
- pOL->SetObjectOrdNum(nNowPos,nNewPos);
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
- ObjOrderChanged(pObj,nNowPos,nNewPos);
+ nCmpPos--;
}
- nNewPos++;
}
+ if (nNowPos!=nNewPos)
+ {
+ bChg=true;
+ pOL->SetObjectOrdNum(nNowPos,nNewPos);
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos));
+ ObjOrderChanged(pObj,nNowPos,nNewPos);
+ }
+ nNewPos++;
+ }
- if(bUndo)
- EndUndo();
+ if(bUndo)
+ EndUndo();
- if(bChg)
- MarkListHasChanged();
- }
+ if(bChg)
+ MarkListHasChanged();
}
void SdrEditView::PutMarkedToTop()
@@ -434,52 +434,52 @@ void SdrEditView::ReverseOrderOfMarked()
{
SortMarkedObjects();
const size_t nMarkCount=GetMarkedObjectCount();
- if (nMarkCount>0)
- {
- bool bChg=false;
+ if (nMarkCount<=0)
+ return;
- bool bUndo = IsUndoEnabled();
- if( bUndo )
- BegUndo(SvxResId(STR_EditRevOrder),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ReverseOrder);
-
- size_t a=0;
- do {
- // take into account selection across multiple PageViews
- size_t b=a+1;
- while (b<nMarkCount && GetSdrPageViewOfMarkedByIndex(b) == GetSdrPageViewOfMarkedByIndex(a)) ++b;
- --b;
- SdrObjList* pOL=GetSdrPageViewOfMarkedByIndex(a)->GetObjList();
- size_t c=b;
- if (a<c) { // make sure OrdNums aren't dirty
- GetMarkedObjectByIndex(a)->GetOrdNum();
- }
- while (a<c) {
- SdrObject* pObj1=GetMarkedObjectByIndex(a);
- SdrObject* pObj2=GetMarkedObjectByIndex(c);
- const size_t nOrd1=pObj1->GetOrdNumDirect();
- const size_t nOrd2=pObj2->GetOrdNumDirect();
- if( bUndo )
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj1,nOrd1,nOrd2));
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj2,nOrd2-1,nOrd1));
- }
- pOL->SetObjectOrdNum(nOrd1,nOrd2);
- // Obj 2 has moved forward by one position, so now nOrd2-1
- pOL->SetObjectOrdNum(nOrd2-1,nOrd1);
- // use Replace instead of SetOrdNum for performance reasons (recalculation of Ordnums)
- ++a;
- --c;
- bChg=true;
+ bool bChg=false;
+
+ bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo(SvxResId(STR_EditRevOrder),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ReverseOrder);
+
+ size_t a=0;
+ do {
+ // take into account selection across multiple PageViews
+ size_t b=a+1;
+ while (b<nMarkCount && GetSdrPageViewOfMarkedByIndex(b) == GetSdrPageViewOfMarkedByIndex(a)) ++b;
+ --b;
+ SdrObjList* pOL=GetSdrPageViewOfMarkedByIndex(a)->GetObjList();
+ size_t c=b;
+ if (a<c) { // make sure OrdNums aren't dirty
+ GetMarkedObjectByIndex(a)->GetOrdNum();
+ }
+ while (a<c) {
+ SdrObject* pObj1=GetMarkedObjectByIndex(a);
+ SdrObject* pObj2=GetMarkedObjectByIndex(c);
+ const size_t nOrd1=pObj1->GetOrdNumDirect();
+ const size_t nOrd2=pObj2->GetOrdNumDirect();
+ if( bUndo )
+ {
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj1,nOrd1,nOrd2));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj2,nOrd2-1,nOrd1));
}
- a=b+1;
- } while (a<nMarkCount);
+ pOL->SetObjectOrdNum(nOrd1,nOrd2);
+ // Obj 2 has moved forward by one position, so now nOrd2-1
+ pOL->SetObjectOrdNum(nOrd2-1,nOrd1);
+ // use Replace instead of SetOrdNum for performance reasons (recalculation of Ordnums)
+ ++a;
+ --c;
+ bChg=true;
+ }
+ a=b+1;
+ } while (a<nMarkCount);
- if(bUndo)
- EndUndo();
+ if(bUndo)
+ EndUndo();
- if(bChg)
- MarkListHasChanged();
- }
+ if(bChg)
+ MarkListHasChanged();
}
void SdrEditView::ImpCheckToTopBtmPossible()
@@ -553,21 +553,21 @@ void SdrEditView::ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest)
}
}
- if(pSource && pDest)
- {
- SfxItemSet aSet(mpModel->GetItemPool(),
- svl::Items<SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1,
- SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
- EE_ITEMS_START, EE_ITEMS_END>{});
+ if(!(pSource && pDest))
+ return;
- aSet.Put(pSource->GetMergedItemSet());
+ SfxItemSet aSet(mpModel->GetItemPool(),
+ svl::Items<SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1,
+ SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END,
+ EE_ITEMS_START, EE_ITEMS_END>{});
- pDest->ClearMergedItem();
- pDest->SetMergedItemSet(aSet);
+ aSet.Put(pSource->GetMergedItemSet());
- pDest->NbcSetLayer(pSource->GetLayer());
- pDest->NbcSetStyleSheet(pSource->GetStyleSheet(), true);
- }
+ pDest->ClearMergedItem();
+ pDest->SetMergedItemSet(aSet);
+
+ pDest->NbcSetLayer(pSource->GetLayer());
+ pDest->NbcSetStyleSheet(pSource->GetStyleSheet(), true);
}
bool SdrEditView::ImpCanConvertForCombine1(const SdrObject* pObj)
@@ -772,216 +772,216 @@ void SdrEditView::DistributeMarkedObjects(weld::Window* pParent)
{
const size_t nMark(GetMarkedObjectCount());
- if(nMark > 2)
- {
- SfxItemSet aNewAttr(mpModel->GetItemPool());
+ if(nMark <= 2)
+ return;
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<AbstractSvxDistributeDialog> pDlg(pFact->CreateSvxDistributeDialog(pParent, aNewAttr));
+ SfxItemSet aNewAttr(mpModel->GetItemPool());
- sal_uInt16 nResult = pDlg->Execute();
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ScopedVclPtr<AbstractSvxDistributeDialog> pDlg(pFact->CreateSvxDistributeDialog(pParent, aNewAttr));
- if(nResult == RET_OK)
- {
- SvxDistributeHorizontal eHor = pDlg->GetDistributeHor();
- SvxDistributeVertical eVer = pDlg->GetDistributeVer();
- ImpDistributeEntryList aEntryList;
- ImpDistributeEntryList::iterator itEntryList;
- sal_uInt32 nFullLength;
+ sal_uInt16 nResult = pDlg->Execute();
- const bool bUndo = IsUndoEnabled();
- if( bUndo )
- BegUndo();
+ if(nResult != RET_OK)
+ return;
- if(eHor != SvxDistributeHorizontal::NONE)
- {
- // build sorted entry list
- nFullLength = 0;
+ SvxDistributeHorizontal eHor = pDlg->GetDistributeHor();
+ SvxDistributeVertical eVer = pDlg->GetDistributeVer();
+ ImpDistributeEntryList aEntryList;
+ ImpDistributeEntryList::iterator itEntryList;
+ sal_uInt32 nFullLength;
- for( size_t a = 0; a < nMark; ++a )
- {
- SdrMark* pMark = GetSdrMarkByIndex(a);
- ImpDistributeEntry aNew;
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
+ BegUndo();
- aNew.mpObj = pMark->GetMarkedSdrObj();
+ if(eHor != SvxDistributeHorizontal::NONE)
+ {
+ // build sorted entry list
+ nFullLength = 0;
- switch(eHor)
- {
- case SvxDistributeHorizontal::Left:
- {
- aNew.mnPos = aNew.mpObj->GetSnapRect().Left();
- break;
- }
- case SvxDistributeHorizontal::Center:
- {
- aNew.mnPos = (aNew.mpObj->GetSnapRect().Right() + aNew.mpObj->GetSnapRect().Left()) / 2;
- break;
- }
- case SvxDistributeHorizontal::Distance:
- {
- aNew.mnLength = aNew.mpObj->GetSnapRect().GetWidth() + 1;
- nFullLength += aNew.mnLength;
- aNew.mnPos = (aNew.mpObj->GetSnapRect().Right() + aNew.mpObj->GetSnapRect().Left()) / 2;
- break;
- }
- case SvxDistributeHorizontal::Right:
- {
- aNew.mnPos = aNew.mpObj->GetSnapRect().Right();
- break;
- }
- default: break;
- }
+ for( size_t a = 0; a < nMark; ++a )
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ ImpDistributeEntry aNew;
- itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
- [&aNew](const ImpDistributeEntry& rEntry) { return rEntry.mnPos >= aNew.mnPos; });
- if ( itEntryList < aEntryList.end() )
- aEntryList.insert( itEntryList, aNew );
- else
- aEntryList.push_back( aNew );
- }
+ aNew.mpObj = pMark->GetMarkedSdrObj();
- if(eHor == SvxDistributeHorizontal::Distance)
+ switch(eHor)
+ {
+ case SvxDistributeHorizontal::Left:
{
- // calculate room in-between
- sal_Int32 nWidth = GetAllMarkedBoundRect().GetWidth() + 1;
- double fStepWidth = (static_cast<double>(nWidth) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1);
- double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
- fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ].mnLength + aEntryList[ 1 ].mnLength) / 2);
-
- // move entries 1..n-1
- for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i )
- {
- ImpDistributeEntry& rCurr = aEntryList[ i ];
- ImpDistributeEntry& rNext = aEntryList[ i + 1];
- sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
- rCurr.mpObj->Move(Size(nDelta, 0));
- fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2);
- }
+ aNew.mnPos = aNew.mpObj->GetSnapRect().Left();
+ break;
}
- else
+ case SvxDistributeHorizontal::Center:
{
- // calculate distances
- sal_Int32 nWidth = aEntryList[ aEntryList.size() - 1 ].mnPos - aEntryList[ 0 ].mnPos;
- double fStepWidth = static_cast<double>(nWidth) / static_cast<double>(aEntryList.size() - 1);
- double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
- fStepStart += fStepWidth;
-
- // move entries 1..n-1
- for( size_t i = 1 ; i < aEntryList.size()-1 ; ++i )
- {
- ImpDistributeEntry& rCurr = aEntryList[ i ];
- sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
- rCurr.mpObj->Move(Size(nDelta, 0));
- fStepStart += fStepWidth;
- }
+ aNew.mnPos = (aNew.mpObj->GetSnapRect().Right() + aNew.mpObj->GetSnapRect().Left()) / 2;
+ break;
}
-
- // clear list
- aEntryList.clear();
+ case SvxDistributeHorizontal::Distance:
+ {
+ aNew.mnLength = aNew.mpObj->GetSnapRect().GetWidth() + 1;
+ nFullLength += aNew.mnLength;
+ aNew.mnPos = (aNew.mpObj->GetSnapRect().Right() + aNew.mpObj->GetSnapRect().Left()) / 2;
+ break;
+ }
+ case SvxDistributeHorizontal::Right:
+ {
+ aNew.mnPos = aNew.mpObj->GetSnapRect().Right();
+ break;
+ }
+ default: break;
}
- if(eVer != SvxDistributeVertical::NONE)
+ itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
+ [&aNew](const ImpDistributeEntry& rEntry) { return rEntry.mnPos >= aNew.mnPos; });
+ if ( itEntryList < aEntryList.end() )
+ aEntryList.insert( itEntryList, aNew );
+ else
+ aEntryList.push_back( aNew );
+ }
+
+ if(eHor == SvxDistributeHorizontal::Distance)
+ {
+ // calculate room in-between
+ sal_Int32 nWidth = GetAllMarkedBoundRect().GetWidth() + 1;
+ double fStepWidth = (static_cast<double>(nWidth) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1);
+ double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
+ fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ].mnLength + aEntryList[ 1 ].mnLength) / 2);
+
+ // move entries 1..n-1
+ for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i )
{
- // build sorted entry list
- nFullLength = 0;
+ ImpDistributeEntry& rCurr = aEntryList[ i ];
+ ImpDistributeEntry& rNext = aEntryList[ i + 1];
+ sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
+ rCurr.mpObj->Move(Size(nDelta, 0));
+ fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2);
+ }
+ }
+ else
+ {
+ // calculate distances
+ sal_Int32 nWidth = aEntryList[ aEntryList.size() - 1 ].mnPos - aEntryList[ 0 ].mnPos;
+ double fStepWidth = static_cast<double>(nWidth) / static_cast<double>(aEntryList.size() - 1);
+ double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
+ fStepStart += fStepWidth;
+
+ // move entries 1..n-1
+ for( size_t i = 1 ; i < aEntryList.size()-1 ; ++i )
+ {
+ ImpDistributeEntry& rCurr = aEntryList[ i ];
+ sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
+ rCurr.mpObj->Move(Size(nDelta, 0));
+ fStepStart += fStepWidth;
+ }
+ }
- for( size_t a = 0; a < nMark; ++a )
- {
- SdrMark* pMark = GetSdrMarkByIndex(a);
- ImpDistributeEntry aNew;
+ // clear list
+ aEntryList.clear();
+ }
- aNew.mpObj = pMark->GetMarkedSdrObj();
+ if(eVer != SvxDistributeVertical::NONE)
+ {
+ // build sorted entry list
+ nFullLength = 0;
- switch(eVer)
- {
- case SvxDistributeVertical::Top:
- {
- aNew.mnPos = aNew.mpObj->GetSnapRect().Top();
- break;
- }
- case SvxDistributeVertical::Center:
- {
- aNew.mnPos = (aNew.mpObj->GetSnapRect().Bottom() + aNew.mpObj->GetSnapRect().Top()) / 2;
- break;
- }
- case SvxDistributeVertical::Distance:
- {
- aNew.mnLength = aNew.mpObj->GetSnapRect().GetHeight() + 1;
- nFullLength += aNew.mnLength;
- aNew.mnPos = (aNew.mpObj->GetSnapRect().Bottom() + aNew.mpObj->GetSnapRect().Top()) / 2;
- break;
- }
- case SvxDistributeVertical::Bottom:
- {
- aNew.mnPos = aNew.mpObj->GetSnapRect().Bottom();
- break;
- }
- default: break;
- }
+ for( size_t a = 0; a < nMark; ++a )
+ {
+ SdrMark* pMark = GetSdrMarkByIndex(a);
+ ImpDistributeEntry aNew;
- itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
- [&aNew](const ImpDistributeEntry& rEntry) { return rEntry.mnPos >= aNew.mnPos; });
- if ( itEntryList < aEntryList.end() )
- aEntryList.insert( itEntryList, aNew );
- else
- aEntryList.push_back( aNew );
- }
+ aNew.mpObj = pMark->GetMarkedSdrObj();
- if(eVer == SvxDistributeVertical::Distance)
+ switch(eVer)
+ {
+ case SvxDistributeVertical::Top:
{
- // calculate room in-between
- sal_Int32 nHeight = GetAllMarkedBoundRect().GetHeight() + 1;
- double fStepWidth = (static_cast<double>(nHeight) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1);
- double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
- fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ].mnLength + aEntryList[ 1 ].mnLength) / 2);
-
- // move entries 1..n-1
- for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i)
- {
- ImpDistributeEntry& rCurr = aEntryList[ i ];
- ImpDistributeEntry& rNext = aEntryList[ i + 1 ];
- sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
- rCurr.mpObj->Move(Size(0, nDelta));
- fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2);
- }
+ aNew.mnPos = aNew.mpObj->GetSnapRect().Top();
+ break;
}
- else
+ case SvxDistributeVertical::Center:
{
- // calculate distances
- sal_Int32 nHeight = aEntryList[ aEntryList.size() - 1 ].mnPos - aEntryList[ 0 ].mnPos;
- double fStepWidth = static_cast<double>(nHeight) / static_cast<double>(aEntryList.size() - 1);
- double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
- fStepStart += fStepWidth;
-
- // move entries 1..n-1
- for(size_t i = 1, n = aEntryList.size()-1; i < n; ++i)
- {
- ImpDistributeEntry& rCurr = aEntryList[ i ];
- sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
- if( bUndo )
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
- rCurr.mpObj->Move(Size(0, nDelta));
- fStepStart += fStepWidth;
- }
+ aNew.mnPos = (aNew.mpObj->GetSnapRect().Bottom() + aNew.mpObj->GetSnapRect().Top()) / 2;
+ break;
}
-
- // clear list
- aEntryList.clear();
+ case SvxDistributeVertical::Distance:
+ {
+ aNew.mnLength = aNew.mpObj->GetSnapRect().GetHeight() + 1;
+ nFullLength += aNew.mnLength;
+ aNew.mnPos = (aNew.mpObj->GetSnapRect().Bottom() + aNew.mpObj->GetSnapRect().Top()) / 2;
+ break;
+ }
+ case SvxDistributeVertical::Bottom:
+ {
+ aNew.mnPos = aNew.mpObj->GetSnapRect().Bottom();
+ break;
+ }
+ default: break;
}
- // UNDO-Comment and end of UNDO
- mpModel->SetUndoComment(SvxResId(STR_DistributeMarkedObjects));
+ itEntryList = std::find_if(aEntryList.begin(), aEntryList.end(),
+ [&aNew](const ImpDistributeEntry& rEntry) { return rEntry.mnPos >= aNew.mnPos; });
+ if ( itEntryList < aEntryList.end() )
+ aEntryList.insert( itEntryList, aNew );
+ else
+ aEntryList.push_back( aNew );
+ }
- if( bUndo )
- EndUndo();
+ if(eVer == SvxDistributeVertical::Distance)
+ {
+ // calculate room in-between
+ sal_Int32 nHeight = GetAllMarkedBoundRect().GetHeight() + 1;
+ double fStepWidth = (static_cast<double>(nHeight) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1);
+ double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
+ fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ].mnLength + aEntryList[ 1 ].mnLength) / 2);
+
+ // move entries 1..n-1
+ for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i)
+ {
+ ImpDistributeEntry& rCurr = aEntryList[ i ];
+ ImpDistributeEntry& rNext = aEntryList[ i + 1 ];
+ sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
+ rCurr.mpObj->Move(Size(0, nDelta));
+ fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2);
+ }
+ }
+ else
+ {
+ // calculate distances
+ sal_Int32 nHeight = aEntryList[ aEntryList.size() - 1 ].mnPos - aEntryList[ 0 ].mnPos;
+ double fStepWidth = static_cast<double>(nHeight) / static_cast<double>(aEntryList.size() - 1);
+ double fStepStart = static_cast<double>(aEntryList[ 0 ].mnPos);
+ fStepStart += fStepWidth;
+
+ // move entries 1..n-1
+ for(size_t i = 1, n = aEntryList.size()-1; i < n; ++i)
+ {
+ ImpDistributeEntry& rCurr = aEntryList[ i ];
+ sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos;
+ if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj));
+ rCurr.mpObj->Move(Size(0, nDelta));
+ fStepStart += fStepWidth;
+ }
}
+
+ // clear list
+ aEntryList.clear();
}
+
+ // UNDO-Comment and end of UNDO
+ mpModel->SetUndoComment(SvxResId(STR_DistributeMarkedObjects));
+
+ if( bUndo )
+ EndUndo();
}
void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode)
@@ -1771,98 +1771,98 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines)
void SdrEditView::GroupMarked()
{
- if (AreObjectsMarked())
+ if (!AreObjectsMarked())
+ return;
+
+ SortMarkedObjects();
+
+ const bool bUndo = IsUndoEnabled();
+ if( bUndo )
{
- SortMarkedObjects();
+ BegUndo(SvxResId(STR_EditGroup),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::Group);
- const bool bUndo = IsUndoEnabled();
- if( bUndo )
+ for(size_t nm = GetMarkedObjectCount(); nm>0; )
{
- BegUndo(SvxResId(STR_EditGroup),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::Group);
-
- for(size_t nm = GetMarkedObjectCount(); nm>0; )
- {
- // add UndoActions for all affected objects
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj = pM->GetMarkedSdrObj();
- AddUndoActions( CreateConnectorUndo( *pObj ) );
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoRemoveObject( *pObj ));
- }
+ // add UndoActions for all affected objects
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj = pM->GetMarkedSdrObj();
+ AddUndoActions( CreateConnectorUndo( *pObj ) );
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoRemoveObject( *pObj ));
}
+ }
- SdrMarkList aNewMark;
- SdrPageView* pPV = GetSdrPageView();
+ SdrMarkList aNewMark;
+ SdrPageView* pPV = GetSdrPageView();
- if(pPV)
+ if(pPV)
+ {
+ SdrObjList* pCurrentLst=pPV->GetObjList();
+ SdrObjList* pSrcLst=pCurrentLst;
+ SdrObjList* pSrcLst0=pSrcLst;
+ // make sure OrdNums are correct
+ if (pSrcLst->IsObjOrdNumsDirty())
+ pSrcLst->RecalcObjOrdNums();
+ SdrObject* pGrp=nullptr;
+ SdrObjList* pDstLst=nullptr;
+ // if all selected objects come from foreign object lists.
+ // the group object is the last one in the list.
+ size_t nInsPos=pSrcLst->GetObjCount();
+ bool bNeedInsPos=true;
+ for (size_t nm=GetMarkedObjectCount(); nm>0;)
{
- SdrObjList* pCurrentLst=pPV->GetObjList();
- SdrObjList* pSrcLst=pCurrentLst;
- SdrObjList* pSrcLst0=pSrcLst;
- // make sure OrdNums are correct
- if (pSrcLst->IsObjOrdNumsDirty())
- pSrcLst->RecalcObjOrdNums();
- SdrObject* pGrp=nullptr;
- SdrObjList* pDstLst=nullptr;
- // if all selected objects come from foreign object lists.
- // the group object is the last one in the list.
- size_t nInsPos=pSrcLst->GetObjCount();
- bool bNeedInsPos=true;
- for (size_t nm=GetMarkedObjectCount(); nm>0;)
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ if (pM->GetPageView()==pPV)
{
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- if (pM->GetPageView()==pPV)
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ if (nullptr==pGrp)
{
- SdrObject* pObj=pM->GetMarkedSdrObj();
- if (nullptr==pGrp)
- {
- pGrp = new SdrObjGroup(pObj->getSdrModelFromSdrObject());
- pDstLst=pGrp->GetSubList();
- DBG_ASSERT(pDstLst!=nullptr,"Alleged group object doesn't return object list.");
- }
- pSrcLst=pObj->getParentSdrObjListFromSdrObject();
- if (pSrcLst!=pSrcLst0)
- {
- if (pSrcLst->IsObjOrdNumsDirty())
- pSrcLst->RecalcObjOrdNums();
- }
- bool bForeignList=pSrcLst!=pCurrentLst;
- if (!bForeignList && bNeedInsPos)
- {
- nInsPos=pObj->GetOrdNum(); // this way, all ObjOrdNum of the page are set
- nInsPos++;
- bNeedInsPos=false;
- }
- pSrcLst->RemoveObject(pObj->GetOrdNumDirect());
- if (!bForeignList)
- nInsPos--; // correct InsertPos
- pDstLst->InsertObject(pObj,0);
- GetMarkedObjectListWriteAccess().DeleteMark(nm);
- pSrcLst0=pSrcLst;
+ pGrp = new SdrObjGroup(pObj->getSdrModelFromSdrObject());
+ pDstLst=pGrp->GetSubList();
+ DBG_ASSERT(pDstLst!=nullptr,"Alleged group object doesn't return object list.");
+ }
+ pSrcLst=pObj->getParentSdrObjListFromSdrObject();
+ if (pSrcLst!=pSrcLst0)
+ {
+ if (pSrcLst->IsObjOrdNumsDirty())
+ pSrcLst->RecalcObjOrdNums();
+ }
+ bool bForeignList=pSrcLst!=pCurrentLst;
+ if (!bForeignList && bNeedInsPos)
+ {
+ nInsPos=pObj->GetOrdNum(); // this way, all ObjOrdNum of the page are set
+ nInsPos++;
+ bNeedInsPos=false;
}
+ pSrcLst->RemoveObject(pObj->GetOrdNumDirect());
+ if (!bForeignList)
+ nInsPos--; // correct InsertPos
+ pDstLst->InsertObject(pObj,0);
+ GetMarkedObjectListWriteAccess().DeleteMark(nm);
+ pSrcLst0=pSrcLst;
}
- if (pGrp!=nullptr)
+ }
+ if (pGrp!=nullptr)
+ {
+ aNewMark.InsertEntry(SdrMark(pGrp,pPV));
+ const size_t nCount=pDstLst->GetObjCount();
+ pCurrentLst->InsertObject(pGrp,nInsPos);
+ if( bUndo )
{
- aNewMark.InsertEntry(SdrMark(pGrp,pPV));
- const size_t nCount=pDstLst->GetObjCount();
- pCurrentLst->InsertObject(pGrp,nInsPos);
- if( bUndo )
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pGrp,true)); // no recalculation!
+ for (size_t no=0; no<nCount; ++no)
{
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pGrp,true)); // no recalculation!
- for (size_t no=0; no<nCount; ++no)
- {
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoInsertObject(*pDstLst->GetObj(no)));
- }
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoInsertObject(*pDstLst->GetObj(no)));
}
}
}
- GetMarkedObjectListWriteAccess().Merge(aNewMark);
- MarkListHasChanged();
-
- if( bUndo )
- EndUndo();
}
+ GetMarkedObjectListWriteAccess().Merge(aNewMark);
+ MarkListHasChanged();
+
+ if( bUndo )
+ EndUndo();
}
@@ -1987,57 +1987,57 @@ SdrObject* SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLine
void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea)
{
- if (AreObjectsMarked()) {
- bool bMrkChg = false;
- const size_t nMarkCount=GetMarkedObjectCount();
- const char* pDscrID = nullptr;
- if(bLineToArea)
- {
- if(nMarkCount == 1)
- pDscrID = STR_EditConvToContour;
- else
- pDscrID = STR_EditConvToContours;
+ if (!AreObjectsMarked()) return;
- BegUndo(SvxResId(pDscrID), GetDescriptionOfMarkedObjects());
- }
+ bool bMrkChg = false;
+ const size_t nMarkCount=GetMarkedObjectCount();
+ const char* pDscrID = nullptr;
+ if(bLineToArea)
+ {
+ if(nMarkCount == 1)
+ pDscrID = STR_EditConvToContour;
else
- {
- if (bPath) {
- if (nMarkCount==1) pDscrID=STR_EditConvToCurve;
- else pDscrID=STR_EditConvToCurves;
- BegUndo(SvxResId(pDscrID),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ConvertToPath);
- } else {
- if (nMarkCount==1) pDscrID=STR_EditConvToPoly;
- else pDscrID=STR_EditConvToPolys;
- BegUndo(SvxResId(pDscrID),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ConvertToPoly);
- }
+ pDscrID = STR_EditConvToContours;
+
+ BegUndo(SvxResId(pDscrID), GetDescriptionOfMarkedObjects());
+ }
+ else
+ {
+ if (bPath) {
+ if (nMarkCount==1) pDscrID=STR_EditConvToCurve;
+ else pDscrID=STR_EditConvToCurves;
+ BegUndo(SvxResId(pDscrID),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ConvertToPath);
+ } else {
+ if (nMarkCount==1) pDscrID=STR_EditConvToPoly;
+ else pDscrID=STR_EditConvToPolys;
+ BegUndo(SvxResId(pDscrID),GetDescriptionOfMarkedObjects(),SdrRepeatFunc::ConvertToPoly);
}
- for (size_t nm=nMarkCount; nm>0;) {
- --nm;
- SdrMark* pM=GetSdrMarkByIndex(nm);
- SdrObject* pObj=pM->GetMarkedSdrObj();
- SdrPageView* pPV=pM->GetPageView();
- if (pObj->IsGroupObject() && !pObj->Is3DObj()) {
- SdrObject* pGrp=pObj;
- SdrObjListIter aIter(*pGrp, SdrIterMode::DeepNoGroups);
- while (aIter.IsMore()) {
- pObj=aIter.Next();
- ImpConvertOneObj(pObj,bPath,bLineToArea);
- }
- } else {
- SdrObject* pNewObj=ImpConvertOneObj(pObj,bPath,bLineToArea);
- if (pNewObj!=nullptr) {
- bMrkChg=true;
- GetMarkedObjectListWriteAccess().ReplaceMark(SdrMark(pNewObj,pPV),nm);
- }
+ }
+ for (size_t nm=nMarkCount; nm>0;) {
+ --nm;
+ SdrMark* pM=GetSdrMarkByIndex(nm);
+ SdrObject* pObj=pM->GetMarkedSdrObj();
+ SdrPageView* pPV=pM->GetPageView();
+ if (pObj->IsGroupObject() && !pObj->Is3DObj()) {
+ SdrObject* pGrp=pObj;
+ SdrObjListIter aIter(*pGrp, SdrIterMode::DeepNoGroups);
+ while (aIter.IsMore()) {
+ pObj=aIter.Next();
+ ImpConvertOneObj(pObj,bPath,bLineToArea);
+ }
+ } else {
+ SdrObject* pNewObj=ImpConvertOneObj(pObj,bPath,bLineToArea);
+ if (pNewObj!=nullptr) {
+ bMrkChg=true;
+ GetMarkedObjectListWriteAccess().ReplaceMark(SdrMark(pNewObj,pPV),nm);
}
}
- EndUndo();
- if (bMrkChg)
- {
- AdjustMarkHdl();
- MarkListHasChanged();
- }
+ }
+ EndUndo();
+ if (bMrkChg)
+ {
+ AdjustMarkHdl();
+ MarkListHasChanged();
}
}
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 9551cf985b03..eaf8a89922b5 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -218,22 +218,22 @@ void SdrObjEditView::TakeActionRect(tools::Rectangle& rRect) const
void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
{
SdrGlueEditView::Notify(rBC, rHint);
- if (pTextEditOutliner != nullptr)
+ if (pTextEditOutliner == nullptr)
+ return;
+
+ // change of printer while editing
+ if (rHint.GetId() != SfxHintId::ThisIsAnSdrHint)
+ return;
+
+ const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
+ SdrHintKind eKind = pSdrHint->GetKind();
+ if (eKind == SdrHintKind::RefDeviceChange)
{
- // change of printer while editing
- if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
- {
- const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
- SdrHintKind eKind = pSdrHint->GetKind();
- if (eKind == SdrHintKind::RefDeviceChange)
- {
- pTextEditOutliner->SetRefDevice(mpModel->GetRefDevice());
- }
- if (eKind == SdrHintKind::DefaultTabChange)
- {
- pTextEditOutliner->SetDefTab(mpModel->GetDefaultTabulator());
- }
- }
+ pTextEditOutliner->SetRefDevice(mpModel->GetRefDevice());
+ }
+ if (eKind == SdrHintKind::DefaultTabChange)
+ {
+ pTextEditOutliner->SetDefTab(mpModel->GetDefaultTabulator());
}
}
@@ -243,142 +243,141 @@ void SdrObjEditView::ModelHasChanged()
if (mxTextEditObj.is() && !mxTextEditObj->IsInserted())
SdrEndTextEdit(); // object deleted
// TextEditObj changed?
- if (IsTextEdit())
+ if (!IsTextEdit())
+ return;
+
+ SdrTextObj* pTextObj = mxTextEditObj.get();
+ if (pTextObj != nullptr)
{
- SdrTextObj* pTextObj = mxTextEditObj.get();
- if (pTextObj != nullptr)
- {
- size_t nOutlViewCnt = pTextEditOutliner->GetViewCount();
- bool bAreaChg = false;
- bool bAnchorChg = false;
- bool bColorChg = false;
- bool bContourFrame = pTextObj->IsContourTextFrame();
- EEAnchorMode eNewAnchor(EEAnchorMode::VCenterHCenter);
- tools::Rectangle aOldArea(aMinTextEditArea);
- aOldArea.Union(aTextEditArea);
- Color aNewColor;
- { // check area
- Size aPaperMin1;
- Size aPaperMax1;
- tools::Rectangle aEditArea1;
- tools::Rectangle aMinArea1;
- pTextObj->TakeTextEditArea(&aPaperMin1, &aPaperMax1, &aEditArea1, &aMinArea1);
- Point aPvOfs(pTextObj->GetTextEditOffset());
-
- // add possible GridOffset to up-to-now view-independent EditAreas
- basegfx::B2DVector aGridOffset(0.0, 0.0);
- if (getPossibleGridOffsetForSdrObject(aGridOffset, pTextObj, GetSdrPageView()))
- {
- const Point aOffset(basegfx::fround(aGridOffset.getX()),
- basegfx::fround(aGridOffset.getY()));
+ size_t nOutlViewCnt = pTextEditOutliner->GetViewCount();
+ bool bAreaChg = false;
+ bool bAnchorChg = false;
+ bool bColorChg = false;
+ bool bContourFrame = pTextObj->IsContourTextFrame();
+ EEAnchorMode eNewAnchor(EEAnchorMode::VCenterHCenter);
+ tools::Rectangle aOldArea(aMinTextEditArea);
+ aOldArea.Union(aTextEditArea);
+ Color aNewColor;
+ { // check area
+ Size aPaperMin1;
+ Size aPaperMax1;
+ tools::Rectangle aEditArea1;
+ tools::Rectangle aMinArea1;
+ pTextObj->TakeTextEditArea(&aPaperMin1, &aPaperMax1, &aEditArea1, &aMinArea1);
+ Point aPvOfs(pTextObj->GetTextEditOffset());
- aEditArea1 += aOffset;
- aMinArea1 += aOffset;
- }
+ // add possible GridOffset to up-to-now view-independent EditAreas
+ basegfx::B2DVector aGridOffset(0.0, 0.0);
+ if (getPossibleGridOffsetForSdrObject(aGridOffset, pTextObj, GetSdrPageView()))
+ {
+ const Point aOffset(basegfx::fround(aGridOffset.getX()),
+ basegfx::fround(aGridOffset.getY()));
- aEditArea1.Move(aPvOfs.X(), aPvOfs.Y());
- aMinArea1.Move(aPvOfs.X(), aPvOfs.Y());
- tools::Rectangle aNewArea(aMinArea1);
- aNewArea.Union(aEditArea1);
+ aEditArea1 += aOffset;
+ aMinArea1 += aOffset;
+ }
- if (aNewArea != aOldArea || aEditArea1 != aTextEditArea
- || aMinArea1 != aMinTextEditArea
- || pTextEditOutliner->GetMinAutoPaperSize() != aPaperMin1
- || pTextEditOutliner->GetMaxAutoPaperSize() != aPaperMax1)
+ aEditArea1.Move(aPvOfs.X(), aPvOfs.Y());
+ aMinArea1.Move(aPvOfs.X(), aPvOfs.Y());
+ tools::Rectangle aNewArea(aMinArea1);
+ aNewArea.Union(aEditArea1);
+
+ if (aNewArea != aOldArea || aEditArea1 != aTextEditArea || aMinArea1 != aMinTextEditArea
+ || pTextEditOutliner->GetMinAutoPaperSize() != aPaperMin1
+ || pTextEditOutliner->GetMaxAutoPaperSize() != aPaperMax1)
+ {
+ aTextEditArea = aEditArea1;
+ aMinTextEditArea = aMinArea1;
+ pTextEditOutliner->SetUpdateMode(false);
+ pTextEditOutliner->SetMinAutoPaperSize(aPaperMin1);
+ pTextEditOutliner->SetMaxAutoPaperSize(aPaperMax1);
+ pTextEditOutliner->SetPaperSize(Size(0, 0)); // re-format Outliner
+ if (!bContourFrame)
{
- aTextEditArea = aEditArea1;
- aMinTextEditArea = aMinArea1;
- pTextEditOutliner->SetUpdateMode(false);
- pTextEditOutliner->SetMinAutoPaperSize(aPaperMin1);
- pTextEditOutliner->SetMaxAutoPaperSize(aPaperMax1);
- pTextEditOutliner->SetPaperSize(Size(0, 0)); // re-format Outliner
- if (!bContourFrame)
- {
- pTextEditOutliner->ClearPolygon();
- EEControlBits nStat = pTextEditOutliner->GetControlWord();
- nStat |= EEControlBits::AUTOPAGESIZE;
- pTextEditOutliner->SetControlWord(nStat);
- }
- else
- {
- EEControlBits nStat = pTextEditOutliner->GetControlWord();
- nStat &= ~EEControlBits::AUTOPAGESIZE;
- pTextEditOutliner->SetControlWord(nStat);
- tools::Rectangle aAnchorRect;
- pTextObj->TakeTextAnchorRect(aAnchorRect);
- pTextObj->ImpSetContourPolygon(*pTextEditOutliner, aAnchorRect, true);
- }
- for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++)
- {
- OutlinerView* pOLV = pTextEditOutliner->GetView(nOV);
- EVControlBits nStat0 = pOLV->GetControlWord();
- EVControlBits nStat = nStat0;
- // AutoViewSize only if not ContourFrame.
- if (!bContourFrame)
- nStat |= EVControlBits::AUTOSIZE;
- else
- nStat &= ~EVControlBits::AUTOSIZE;
- if (nStat != nStat0)
- pOLV->SetControlWord(nStat);
- }
- pTextEditOutliner->SetUpdateMode(true);
- bAreaChg = true;
+ pTextEditOutliner->ClearPolygon();
+ EEControlBits nStat = pTextEditOutliner->GetControlWord();
+ nStat |= EEControlBits::AUTOPAGESIZE;
+ pTextEditOutliner->SetControlWord(nStat);
+ }
+ else
+ {
+ EEControlBits nStat = pTextEditOutliner->GetControlWord();
+ nStat &= ~EEControlBits::AUTOPAGESIZE;
+ pTextEditOutliner->SetControlWord(nStat);
+ tools::Rectangle aAnchorRect;
+ pTextObj->TakeTextAnchorRect(aAnchorRect);
+ pTextObj->ImpSetContourPolygon(*pTextEditOutliner, aAnchorRect, true);
}
- }
- if (pTextEditOutlinerView != nullptr)
- { // check fill and anchor
- EEAnchorMode eOldAnchor = pTextEditOutlinerView->GetAnchorMode();
- eNewAnchor = pTextObj->GetOutlinerViewAnchorMode();
- bAnchorChg = eOldAnchor != eNewAnchor;
- Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
- aNewColor = GetTextEditBackgroundColor(*this);
- bColorChg = aOldColor != aNewColor;
- }
- // refresh always when it's a contour frame. That
- // refresh is necessary since it triggers the repaint
- // which makes the Handles visible. Changes at TakeTextRect()
- // seem to have resulted in a case where no refresh is executed.
- // Before that, a refresh must have been always executed
- // (else this error would have happened earlier), thus I
- // even think here a refresh should be done always.
- // Since follow-up problems cannot even be guessed I only
- // add this one more case to the if below.
- // BTW: It's VERY bad style that here, inside ModelHasChanged()
- // the outliner is again massively changed for the text object
- // in text edit mode. Normally, all necessary data should be
- // set at SdrBeginTextEdit(). Some changes and value assigns in
- // SdrBeginTextEdit() are completely useless since they are set here
- // again on ModelHasChanged().
- if (bContourFrame || bAreaChg || bAnchorChg || bColorChg)
- {
for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++)
{
OutlinerView* pOLV = pTextEditOutliner->GetView(nOV);
- { // invalidate old OutlinerView area
- vcl::Window* pWin = pOLV->GetWindow();
- tools::Rectangle aTmpRect(aOldArea);
- sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1;
- Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz)));
- aTmpRect.AdjustLeft(-(aMore.Width()));
- aTmpRect.AdjustRight(aMore.Width());
- aTmpRect.AdjustTop(-(aMore.Height()));
- aTmpRect.AdjustBottom(aMore.Height());
- InvalidateOneWin(*pWin, aTmpRect);
- }
- if (bAnchorChg)
- pOLV->SetAnchorMode(eNewAnchor);
- if (bColorChg)
- pOLV->SetBackgroundColor(aNewColor);
-
- pOLV->SetOutputArea(
- aTextEditArea); // because otherwise, we're not re-anchoring correctly
- ImpInvalidateOutlinerView(*pOLV);
+ EVControlBits nStat0 = pOLV->GetControlWord();
+ EVControlBits nStat = nStat0;
+ // AutoViewSize only if not ContourFrame.
+ if (!bContourFrame)
+ nStat |= EVControlBits::AUTOSIZE;
+ else
+ nStat &= ~EVControlBits::AUTOSIZE;
+ if (nStat != nStat0)
+ pOLV->SetControlWord(nStat);
+ }
+ pTextEditOutliner->SetUpdateMode(true);
+ bAreaChg = true;
+ }
+ }
+ if (pTextEditOutlinerView != nullptr)
+ { // check fill and anchor
+ EEAnchorMode eOldAnchor = pTextEditOutlinerView->GetAnchorMode();
+ eNewAnchor = pTextObj->GetOutlinerViewAnchorMode();
+ bAnchorChg = eOldAnchor != eNewAnchor;
+ Color aOldColor(pTextEditOutlinerView->GetBackgroundColor());
+ aNewColor = GetTextEditBackgroundColor(*this);
+ bColorChg = aOldColor != aNewColor;
+ }
+ // refresh always when it's a contour frame. That
+ // refresh is necessary since it triggers the repaint
+ // which makes the Handles visible. Changes at TakeTextRect()
+ // seem to have resulted in a case where no refresh is executed.
+ // Before that, a refresh must have been always executed
+ // (else this error would have happened earlier), thus I
+ // even think here a refresh should be done always.
+ // Since follow-up problems cannot even be guessed I only
+ // add this one more case to the if below.
+ // BTW: It's VERY bad style that here, inside ModelHasChanged()
+ // the outliner is again massively changed for the text object
+ // in text edit mode. Normally, all necessary data should be
+ // set at SdrBeginTextEdit(). Some changes and value assigns in
+ // SdrBeginTextEdit() are completely useless since they are set here
+ // again on ModelHasChanged().
+ if (bContourFrame || bAreaChg || bAnchorChg || bColorChg)
+ {
+ for (size_t nOV = 0; nOV < nOutlViewCnt; nOV++)
+ {
+ OutlinerView* pOLV = pTextEditOutliner->GetView(nOV);
+ { // invalidate old OutlinerView area
+ vcl::Window* pWin = pOLV->GetWindow();
+ tools::Rectangle aTmpRect(aOldArea);
+ sal_uInt16 nPixSiz = pOLV->GetInvalidateMore() + 1;
+ Size aMore(pWin->PixelToLogic(Size(nPixSiz, nPixSiz)));
+ aTmpRect.AdjustLeft(-(aMore.Width()));
+ aTmpRect.AdjustRight(aMore.Width());
+ aTmpRect.AdjustTop(-(aMore.Height()));
+ aTmpRect.AdjustBottom(aMore.Height());
+ InvalidateOneWin(*pWin, aTmpRect);
}
- pTextEditOutlinerView->ShowCursor();
+ if (bAnchorChg)
+ pOLV->SetAnchorMode(eNewAnchor);
+ if (bColorChg)
+ pOLV->SetBackgroundColor(aNewColor);
+
+ pOLV->SetOutputArea(
+ aTextEditArea); // because otherwise, we're not re-anchoring correctly
+ ImpInvalidateOutlinerView(*pOLV);
}
+ pTextEditOutlinerView->ShowCursor();
}
- ImpMakeTextCursorAreaVisible();
}
+ ImpMakeTextCursorAreaVisible();
}
namespace
@@ -590,27 +589,27 @@ void TextEditOverlayObject::checkDataChange(const basegfx::B2DRange& rMinTextEdi
void TextEditOverlayObject::checkSelectionChange()
{
- if (getOverlaySelection() && getOverlayManager())
- {
- std::vector<tools::Rectangle> aLogicRects;
- std::vector<basegfx::B2DRange> aLogicRanges;
- const Size aLogicPixel(getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1)));
+ if (!(getOverlaySelection() && getOverlayManager()))
+ return;
- // get logic selection
- getOutlinerView().GetSelectionRectangles(aLogicRects);
+ std::vector<tools::Rectangle> aLogicRects;
+ std::vector<basegfx::B2DRange> aLogicRanges;
+ const Size aLogicPixel(getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1)));
- aLogicRanges.reserve(aLogicRects.size());
- for (const auto& aRect : aLogicRects)
- {
- // convert from logic Rectangles to logic Ranges, do not forget to add
- // one Unit (in this case logical units for one pixel, pre-calculated)
- aLogicRanges.emplace_back(
- aRect.Left() - aLogicPixel.Width(), aRect.Top() - aLogicPixel.Height(),
- aRect.Right() + aLogicPixel.Width(), aRect.Bottom() + aLogicPixel.Height());
- }
+ // get logic selection
+ getOutlinerView().GetSelectionRectangles(aLogicRects);
- mpOverlaySelection->setRanges(aLogicRanges);
+ aLogicRanges.reserve(aLogicRects.size());
+ for (const auto& aRect : aLogicRects)
+ {
+ // convert from logic Rectangles to logic Ranges, do not forget to add
+ // one Unit (in this case logical units for one pixel, pre-calculated)
+ aLogicRanges.emplace_back(
+ aRect.Left() - aLogicPixel.Width(), aRect.Top() - aLogicPixel.Height(),
+ aRect.Right() + aLogicPixel.Width(), aRect.Bottom() + aLogicPixel.Height());
}
+
+ mpOverlaySelection->setRanges(aLogicRanges);
}
} // end of anonymous namespace
@@ -621,21 +620,21 @@ void TextEditOverlayObject::checkSelectionChange()
// is an integral part of the text visualization
void SdrObjEditView::EditViewInvalidate(const tools::Rectangle&) const
{
- if (IsTextEdit())
+ if (!IsTextEdit())
+ return;
+
+ // MinTextRange may have changed. Forward it, too
+ const basegfx::B2DRange aMinTextRange
+ = vcl::unotools::b2DRectangleFromRectangle(aMinTextEditArea);
+
+ for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
{
- // MinTextRange may have changed. Forward it, too
- const basegfx::B2DRange aMinTextRange
- = vcl::unotools::b2DRectangleFromRectangle(aMinTextEditArea);
+ TextEditOverlayObject* pCandidate
+ = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
- for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
+ if (pCandidate)
{
- TextEditOverlayObject* pCandidate
- = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
-
- if (pCandidate)
- {
- pCandidate->checkDataChange(aMinTextRange);
- }
+ pCandidate->checkDataChange(aMinTextRange);
}
}
}
@@ -645,17 +644,17 @@ void SdrObjEditView::EditViewInvalidate(const tools::Rectangle&) const
// which is e.g. used when only the selection is changed, but not the text
void SdrObjEditView::EditViewSelectionChange() const
{
- if (IsTextEdit())
+ if (!IsTextEdit())
+ return;
+
+ for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
{
- for (sal_uInt32 a(0); a < maTEOverlayGroup.count(); a++)
- {
- TextEditOverlayObject* pCandidate
- = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
+ TextEditOverlayObject* pCandidate
+ = dynamic_cast<TextEditOverlayObject*>(&maTEOverlayGroup.getOverlayObject(a));
- if (pCandidate)
- {
- pCandidate->checkSelectionChange();
- }
+ if (pCandidate)
+ {
+ pCandidate->checkSelectionChange();
}
}
}
@@ -777,53 +776,53 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView const& rOutlView) co
{
vcl::Window* pWin = rOutlView.GetWindow();
- if (pWin)
- {
- const SdrTextObj* pText = GetTextEditObject();
- bool bTextFrame(pText && pText->IsTextFrame());
- bool bFitToSize(pText && pText->IsFitToSize());
+ if (!pWin)
+ return;
- if (bTextFrame && !bFitToSize)
- {
- tools::Rectangle aBlankRect(rOutlView.GetOutputArea());
- aBlankRect.Union(aMinTextEditArea);
- tools::Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
- sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
+ const SdrTextObj* pText = GetTextEditObject();
+ bool bTextFrame(pText && pText->IsTextFrame());
+ bool bFitToSize(pText && pText->IsFitToSize());
- aPixRect.AdjustLeft(-1);
- aPixRect.AdjustTop(-1);
- aPixRect.AdjustRight(1);
- aPixRect.AdjustBottom(1);
+ if (!(bTextFrame && !bFitToSize))
+ return;
- {
- // limit xPixRect because of driver problems when pixel coordinates are too far out
- Size aMaxXY(pWin->GetOutputSizePixel());
- long a(2 * nPixSiz);
- long nMaxX(aMaxXY.Width() + a);
- long nMaxY(aMaxXY.Height() + a);
-
- if (aPixRect.Left() < -a)
- aPixRect.SetLeft(-a);
- if (aPixRect.Top() < -a)
- aPixRect.SetTop(-a);
- if (aPixRect.Right() > nMaxX)
- aPixRect.SetRight(nMaxX);
- if (aPixRect.Bottom() > nMaxY)
- aPixRect.SetBottom(nMaxY);
- }
+ tools::Rectangle aBlankRect(rOutlView.GetOutputArea());
+ aBlankRect.Union(aMinTextEditArea);
+ tools::Rectangle aPixRect(pWin->LogicToPixel(aBlankRect));
+ sal_uInt16 nPixSiz(rOutlView.GetInvalidateMore() - 1);
- tools::Rectangle aOuterPix(aPixRect);
- aOuterPix.AdjustLeft(-nPixSiz);
- aOuterPix.AdjustTop(-nPixSiz);
- aOuterPix.AdjustRight(nPixSiz);
- aOuterPix.AdjustBottom(nPixSiz);
+ aPixRect.AdjustLeft(-1);
+ aPixRect.AdjustTop(-1);
+ aPixRect.AdjustRight(1);
+ aPixRect.AdjustBottom(1);
- bool bMapModeEnabled(pWin->IsMapModeEnabled());
- pWin->EnableMapMode(false);
- pWin->Invalidate(aOuterPix);
- pWin->EnableMapMode(bMapModeEnabled);
- }
+ {
+ // limit xPixRect because of driver problems when pixel coordinates are too far out
+ Size aMaxXY(pWin->GetOutputSizePixel());
+ long a(2 * nPixSiz);
+ long nMaxX(aMaxXY.Width() + a);
+ long nMaxY(aMaxXY.Height() + a);
+
+ if (aPixRect.Left() < -a)
+ aPixRect.SetLeft(-a);
+ if (aPixRect.Top() < -a)
+ aPixRect.SetTop(-a);
+ if (aPixRect.Right() > nMaxX)
+ aPixRect.SetRight(nMaxX);
+ if (aPixRect.Bottom() > nMaxY)
+ aPixRect.SetBottom(nMaxY);
}
+
+ tools::Rectangle aOuterPix(aPixRect);
+ aOuterPix.AdjustLeft(-nPixSiz);
+ aOuterPix.AdjustTop(-nPixSiz);
+ aOuterPix.AdjustRight(nPixSiz);
+ aOuterPix.AdjustBottom(nPixSiz);
+
+ bool bMapModeEnabled(pWin->IsMapModeEnabled());
+ pWin->EnableMapMode(false);
+ pWin->Invalidate(aOuterPix);
+ pWin->EnableMapMode(bMapModeEnabled);
}
OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, OutlinerView* pGivenView,
@@ -896,70 +895,70 @@ IMPL_LINK(SdrObjEditView, ImpOutlinerStatusEventHdl, EditStatus&, rEditStat, voi
void SdrObjEditView::ImpChainingEventHdl()
{
- if (pTextEditOutliner)
+ if (!pTextEditOutliner)
+ return;
+
+ SdrTextObj* pTextObj = mxTextEditObj.get();
+ OutlinerView* pOLV = GetTextEditOutlinerView();
+ if (pTextObj && pOLV)
{
- SdrTextObj* pTextObj = mxTextEditObj.get();
- OutlinerView* pOLV = GetTextEditOutlinerView();
- if (pTextObj && pOLV)
- {
- TextChain* pTextChain = pTextObj->GetTextChain();
+ TextChain* pTextChain = pTextObj->GetTextChain();
- // XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm
- if (!pTextObj->IsChainable())
- {
- return;
- }
- // This is true during an underflow-caused overflow (with pEdtOutl->SetText())
- if (pTextChain->GetNilChainingEvent(pTextObj))
- {
- return;
- }
+ // XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm
+ if (!pTextObj->IsChainable())
+ {
+ return;
+ }
+ // This is true during an underflow-caused overflow (with pEdtOutl->SetText())
+ if (pTextChain->GetNilChainingEvent(pTextObj))
+ {
+ return;
+ }
- // We prevent to trigger further handling of overflow/underflow for pTextObj
- pTextChain->SetNilChainingEvent(pTextObj, true); // XXX
+ // We prevent to trigger further handling of overflow/underflow for pTextObj
+ pTextChain->SetNilChainingEvent(pTextObj, true); // XXX
- // Save previous selection pos // NOTE: It must be done to have the right CursorEvent in KeyInput
- pTextChain->SetPreChainingSel(pTextObj, pOLV->GetSelection());
- //maPreChainingSel = new ESelection(pOLV->GetSelection());
+ // Save previous selection pos // NOTE: It must be done to have the right CursorEvent in KeyInput
+ pTextChain->SetPreChainingSel(pTextObj, pOLV->GetSelection());
+ //maPreChainingSel = new ESelection(pOLV->GetSelection());
- // Handling Undo
- const int nText = 0; // XXX: hardcoded index (SdrTextObj::getText handles only 0)
+ // Handling Undo
+ const int nText = 0; // XXX: hardcoded index (SdrTextObj::getText handles only 0)
- const bool bUndoEnabled = GetModel() && IsUndoEnabled();
- std::unique_ptr<SdrUndoObjSetText> pTxtUndo;
- if (bUndoEnabled)
- pTxtUndo.reset(
- dynamic_cast<SdrUndoObjSetText*>(GetModel()
- ->GetSdrUndoFactory()
- .CreateUndoObjectSetText(*pTextObj, nText)
- .release()));
+ const bool bUndoEnabled = GetModel() && IsUndoEnabled();
+ std::unique_ptr<SdrUndoObjSetText> pTxtUndo;
+ if (bUndoEnabled)
+ pTxtUndo.reset(
+ dynamic_cast<SdrUndoObjSetText*>(GetModel()
+ ->GetSdrUndoFactory()
+ .CreateUndoObjectSetText(*pTextObj, nText)
+ .release()));
- // trigger actual chaining
- pTextObj->onChainingEvent();
+ // trigger actual chaining
+ pTextObj->onChainingEvent();
- if (pTxtUndo)
+ if (pTxtUndo)
+ {
+ pTxtUndo->AfterSetText();
+ if (!pTxtUndo->IsDifferent())
{
- pTxtUndo->AfterSetText();
- if (!pTxtUndo->IsDifferent())
- {
- pTxtUndo.reset();
- }
+ pTxtUndo.reset();
}
+ }
- if (pTxtUndo)
- AddUndo(std::move(pTxtUndo));
+ if (pTxtUndo)
+ AddUndo(std::move(pTxtUndo));
- //maCursorEvent = new CursorChainingEvent(pTextChain->GetCursorEvent(pTextObj));
- //SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
+ //maCursorEvent = new CursorChainingEvent(pTextChain->GetCursorEvent(pTextObj));
+ //SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
- // NOTE: Must be called. Don't let the function return if you set it to true and not reset it
- pTextChain->SetNilChainingEvent(pTextObj, false);
- }
- else
- {
- // XXX
- SAL_INFO("svx.chaining", "[OnChaining] No Edit Outliner View");
- }
+ // NOTE: Must be called. Don't let the function return if you set it to true and not reset it
+ pTextChain->SetNilChainingEvent(pTextObj, false);
+ }
+ else
+ {
+ // XXX
+ SAL_INFO("svx.chaining", "[OnChaining] No Edit Outliner View");
}
}
@@ -1677,21 +1676,21 @@ OutlinerView* SdrObjEditView::ImpFindOutlinerView(vcl::Window const* pWin) const
void SdrObjEditView::SetTextEditWin(vcl::Window* pWin)
{
- if (mxTextEditObj.is() && pWin != nullptr && pWin != pTextEditWin)
+ if (!(mxTextEditObj.is() && pWin != nullptr && pWin != pTextEditWin))
+ return;
+
+ OutlinerView* pNewView = ImpFindOutlinerView(pWin);
+ if (pNewView != nullptr && pNewView != pTextEditOutlinerView)
{
- OutlinerView* pNewView = ImpFindOutlinerView(pWin);
- if (pNewView != nullptr && pNewView != pTextEditOutlinerView)
+ if (pTextEditOutlinerView != nullptr)
{
- if (pTextEditOutlinerView != nullptr)
- {
- pTextEditOutlinerView->HideCursor();
- }
- pTextEditOutlinerView = pNewView;
- pTextEditWin = pWin;
- pWin->GrabFocus(); // Make the cursor blink here as well
- pNewView->ShowCursor();
- ImpMakeTextCursorAreaVisible();
+ pTextEditOutlinerView->HideCursor();
}
+ pTextEditOutlinerView = pNewView;
+ pTextEditWin = pWin;
+ pWin->GrabFocus(); // Make the cursor blink here as well
+ pNewView->ShowCursor();
+ ImpMakeTextCursorAreaVisible();
}
}
@@ -2386,19 +2385,19 @@ void SdrObjEditView::ImpMacroDown(const Point& rDownPos)
void SdrObjEditView::MovMacroObj(const Point& rPnt)
{
- if (pMacroObj != nullptr)
- {
- SdrObjMacroHitRec aHitRec;
- aHitRec.aPos = rPnt;
- aHitRec.nTol = nMacroTol;
- aHitRec.pVisiLayer = &pMacroPV->GetVisibleLayers();
- aHitRec.pPageView = pMacroPV;
- bool bDown = pMacroObj->IsMacroHit(aHitRec);
- if (bDown)
- ImpMacroDown(rPnt);
- else
- ImpMacroUp(rPnt);
- }
+ if (pMacroObj == nullptr)
+ return;
+
+ SdrObjMacroHitRec aHitRec;
+ aHitRec.aPos = rPnt;
+ aHitRec.nTol = nMacroTol;
+ aHitRec.pVisiLayer = &pMacroPV->GetVisibleLayers();
+ aHitRec.pPageView = pMacroPV;
+ bool bDown = pMacroObj->IsMacroHit(aHitRec);
+ if (bDown)
+ ImpMacroDown(rPnt);
+ else
+ ImpMacroUp(rPnt);
}
void SdrObjEditView::BrkMacroObj()
@@ -2439,28 +2438,25 @@ bool SdrObjEditView::EndMacroObj()
Leaves the any untouched if there currently is no text selected */
void SdrObjEditView::getTextSelection(css::uno::Any& rSelection)
{
- if (IsTextEdit())
+ if (!IsTextEdit())
+ return;
+
+ OutlinerView* pOutlinerView = GetTextEditOutlinerView();
+ if (!(pOutlinerView && pOutlinerView->HasSelection()))
+ return;
+
+ SdrObject* pObj = GetTextEditObject();
+
+ if (!pObj)
+ return;
+
+ css::uno::Reference<css::text::XText> xText(pObj->getUnoShape(), css::uno::UNO_QUERY);
+ if (xText.is())
{
- OutlinerView* pOutlinerView = GetTextEditOutlinerView();
- if (pOutlinerView && pOutlinerView->HasSelection())
+ SvxUnoTextBase* pRange = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>(xText);
+ if (pRange)
{
- SdrObject* pObj = GetTextEditObject();
-
- if (pObj)
- {
- css::uno::Reference<css::text::XText> xText(pObj->getUnoShape(),
- css::uno::UNO_QUERY);
- if (xText.is())
- {
- SvxUnoTextBase* pRange
- = comphelper::getUnoTunnelImplementation<SvxUnoTextBase>(xText);
- if (pRange)
- {
- rSelection
- <<= pRange->createTextCursorBySelection(pOutlinerView->GetSelection());
- }
- }
- }
+ rSelection <<= pRange->createTextCursorBySelection(pOutlinerView->GetSelection());
}
}
}
@@ -2485,24 +2481,23 @@ void SdrObjEditView::MarkListHasChanged()
mxSelectionController.clear();
const SdrMarkList& rMarkList = GetMarkedObjectList();
- if (rMarkList.GetMarkCount() == 1)
+ if (rMarkList.GetMarkCount() != 1)
+ return;
+
+ const SdrObject* pObj(rMarkList.GetMark(0)->GetMarkedSdrObj());
+ SdrView* pView(dynamic_cast<SdrView*>(this));
+
+ // check for table
+ if (pObj && pView && (pObj->GetObjInventor() == SdrInventor::Default)
+ && (pObj->GetObjIdentifier() == OBJ_TABLE))
{
- const SdrObject* pObj(rMarkList.GetMark(0)->GetMarkedSdrObj());
- SdrView* pView(dynamic_cast<SdrView*>(this));
+ mxSelectionController = sdr::table::CreateTableController(
+ *pView, static_cast<const sdr::table::SdrTableObj&>(*pObj), mxLastSelectionController);
- // check for table
- if (pObj && pView && (pObj->GetObjInventor() == SdrInventor::Default)
- && (pObj->GetObjIdentifier() == OBJ_TABLE))
+ if (mxSelectionController.is())
{
- mxSelectionController = sdr::table::CreateTableController(
- *pView, static_cast<const sdr::table::SdrTableObj&>(*pObj),
- mxLastSelectionController);
-
- if (mxSelectionController.is())
- {
- mxLastSelectionController.clear();
- mxSelectionController->onSelectionHasChanged();
- }
+ mxLastSelectionController.clear();
+ mxSelectionController->onSelectionHasChanged();
}
}
}
@@ -2637,32 +2632,32 @@ static const sal_uInt16* GetFormatRangeImpl(bool bTextOnly)
void SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFormatSet)
{
const SdrMarkList& rMarkList = GetMarkedObjectList();
- if (rMarkList.GetMarkCount() > 0)
- {
- OutlinerView* pOLV = GetTextEditOutlinerView();
+ if (rMarkList.GetMarkCount() <= 0)
+ return;
- rFormatSet = std::make_shared<SfxItemSet>(GetModel()->GetItemPool(),
- GetFormatRangeImpl(pOLV != nullptr));
- if (pOLV)
- {
- rFormatSet->Put(pOLV->GetAttribs());
- }
- else
- {
- const bool bOnlyHardAttr = false;
- rFormatSet->Put(GetAttrFromMarked(bOnlyHardAttr));
- }
+ OutlinerView* pOLV = GetTextEditOutlinerView();
- // check for cloning from table cell, in which case we need to copy cell-specific formatting attributes
- const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- if (pObj && (pObj->GetObjInventor() == SdrInventor::Default)
- && (pObj->GetObjIdentifier() == OBJ_TABLE))
+ rFormatSet = std::make_shared<SfxItemSet>(GetModel()->GetItemPool(),
+ GetFormatRangeImpl(pOLV != nullptr));
+ if (pOLV)
+ {
+ rFormatSet->Put(pOLV->GetAttribs());
+ }
+ else
+ {
+ const bool bOnlyHardAttr = false;
+ rFormatSet->Put(GetAttrFromMarked(bOnlyHardAttr));
+ }
+
+ // check for cloning from table cell, in which case we need to copy cell-specific formatting attributes
+ const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if (pObj && (pObj->GetObjInventor() == SdrInventor::Default)
+ && (pObj->GetObjIdentifier() == OBJ_TABLE))
+ {
+ auto pTable = static_cast<const sdr::table::SdrTableObj*>(pObj);
+ if (mxSelectionController.is() && pTable->getActiveCell().is())
{
- auto pTable = static_cast<const sdr::table::SdrTableObj*>(pObj);
- if (mxSelectionController.is() && pTable->getActiveCell().is())
- {
- mxSelectionController->GetAttributes(*rFormatSet, false);
- }
+ mxSelectionController->GetAttributes(*rFormatSet, false);
}
}
}
@@ -2704,32 +2699,32 @@ void SdrObjEditView::ApplyFormatPaintBrushToText(SfxItemSet const& rFormatSet, S
bool bNoParagraphFormats)
{
OutlinerParaObject* pParaObj = pText ? pText->GetOutlinerParaObject() : nullptr;
- if (pParaObj)
- {
- SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner();
- rOutliner.SetText(*pParaObj);
+ if (!pParaObj)
+ return;
- sal_Int32 nParaCount(rOutliner.GetParagraphCount());
+ SdrOutliner& rOutliner = rTextObj.ImpGetDrawOutliner();
+ rOutliner.SetText(*pParaObj);
- if (nParaCount)
- {
- for (sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
- {
- if (!bNoCharacterFormats)
- rOutliner.RemoveCharAttribs(nPara);
+ sal_Int32 nParaCount(rOutliner.GetParagraphCount());
- SfxItemSet aSet(rOutliner.GetParaAttribs(nPara));
- aSet.Put(CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet,
- bNoCharacterFormats, bNoParagraphFormats));
- rOutliner.SetParaAttribs(nPara, aSet);
- }
+ if (!nParaCount)
+ return;
- std::unique_ptr<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
- rOutliner.Clear();
+ for (sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
+ {
+ if (!bNoCharacterFormats)
+ rOutliner.RemoveCharAttribs(nPara);
- rTextObj.NbcSetOutlinerParaObjectForText(std::move(pTemp), pText);
- }
+ SfxItemSet aSet(rOutliner.GetParaAttribs(nPara));
+ aSet.Put(CreatePaintSet(GetFormatRangeImpl(true), *aSet.GetPool(), rFormatSet, aSet,
+ bNoCharacterFormats, bNoParagraphFormats));
+ rOutliner.SetParaAttribs(nPara, aSet);
}
+
+ std::unique_ptr<OutlinerParaObject> pTemp = rOutliner.CreateParaObject(0, nParaCount);
+ rOutliner.Clear();
+
+ rTextObj.NbcSetOutlinerParaObjectForText(std::move(pTemp), pText);
}
void SdrObjEditView::ApplyFormatPaintBrush(SfxItemSet& rFormatSet, bool bNoCharacterFormats,
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 4adefe0cb096..1f62442af896 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -422,25 +422,25 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr
mbFntDirty = false;
}
- if(pObj)
- {
- pObj->SetLayer(mnLayer);
+ if(!pObj)
+ return;
- if(bLine)
- {
- pObj->SetMergedItemSet(*mpLineAttr);
- }
+ pObj->SetLayer(mnLayer);
- if(bFill)
- {
- pObj->SetMergedItemSet(*mpFillAttr);
- }
+ if(bLine)
+ {
+ pObj->SetMergedItemSet(*mpLineAttr);
+ }
- if(bText)
- {
- pObj->SetMergedItemSet(*mpTextAttr);
- pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
- }
+ if(bFill)
+ {
+ pObj->SetMergedItemSet(*mpFillAttr);
+ }
+
+ if(bText)
+ {
+ pObj->SetMergedItemSet(*mpTextAttr);
+ pObj->SetMergedItem(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_LEFT));
}
}
@@ -596,65 +596,65 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale)
}
}
- if(pObj)
+ if(!pObj)
+ return;
+
+ // #i111954# check object for visibility
+ // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
+ bool bVisible(false);
+
+ if(pObj->HasLineStyle())
+ {
+ bVisible = true;
+ }
+
+ if(!bVisible && pObj->HasFillStyle())
+ {
+ bVisible = true;
+ }
+
+ if(!bVisible)
{
- // #i111954# check object for visibility
- // used are SdrPathObj, SdrRectObj, SdrCircObj, SdrGrafObj
- bool bVisible(false);
+ SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
- if(pObj->HasLineStyle())
+ if(pTextObj && pTextObj->HasText())
{
bVisible = true;
}
+ }
+
+ if(!bVisible)
+ {
+ SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
- if(!bVisible && pObj->HasFillStyle())
+ if(pGrafObj)
{
+ // this may be refined to check if the graphic really is visible. It
+ // is here to ensure that graphic objects without fill, line and text
+ // get created
bVisible = true;
}
+ }
- if(!bVisible)
- {
- SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >(pObj);
-
- if(pTextObj && pTextObj->HasText())
- {
- bVisible = true;
- }
- }
+ if(!bVisible)
+ {
+ SdrObject::Free(pObj);
+ }
+ else
+ {
+ maTmpList.push_back(pObj);
- if(!bVisible)
+ if(dynamic_cast< SdrPathObj* >(pObj))
{
- SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
+ const bool bClosed(pObj->IsClosedObj());
- if(pGrafObj)
- {
- // this may be refined to check if the graphic really is visible. It
- // is here to ensure that graphic objects without fill, line and text
- // get created
- bVisible = true;
- }
- }
-
- if(!bVisible)
- {
- SdrObject::Free(pObj);
+ mbLastObjWasPolyWithoutLine = mbNoLine && bClosed;
+ mbLastObjWasLine = !bClosed;
}
else
{
- maTmpList.push_back(pObj);
-
- if(dynamic_cast< SdrPathObj* >(pObj))
- {
- const bool bClosed(pObj->IsClosedObj());
-
- mbLastObjWasPolyWithoutLine = mbNoLine && bClosed;
- mbLastObjWasLine = !bClosed;
- }
- else
- {
- mbLastObjWasPolyWithoutLine = false;
- mbLastObjWasLine = false;
- }
+ mbLastObjWasPolyWithoutLine = false;
+ mbLastObjWasLine = false;
}
}
}
@@ -665,44 +665,44 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction const & rAct)
const basegfx::B2DPoint aStart(rAct.GetStartPoint().X(), rAct.GetStartPoint().Y());
const basegfx::B2DPoint aEnd(rAct.GetEndPoint().X(), rAct.GetEndPoint().Y());
- if(!aStart.equal(aEnd))
- {
- basegfx::B2DPolygon aLine;
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ if(aStart.equal(aEnd))
+ return;
- aLine.append(aStart);
- aLine.append(aEnd);
- aLine.transform(aTransform);
+ basegfx::B2DPolygon aLine;
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- const LineInfo& rLineInfo = rAct.GetLineInfo();
- const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
- bool bCreateLineObject(true);
+ aLine.append(aStart);
+ aLine.append(aEnd);
+ aLine.transform(aTransform);
- if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aLine))
- {
- bCreateLineObject = false;
- }
+ const LineInfo& rLineInfo = rAct.GetLineInfo();
+ const sal_Int32 nNewLineWidth(rLineInfo.GetWidth());
+ bool bCreateLineObject(true);
- if(bCreateLineObject)
- {
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_LINE,
- basegfx::B2DPolyPolygon(aLine));
- mnLineWidth = nNewLineWidth;
- maLineJoin = rLineInfo.GetLineJoin();
- maLineCap = rLineInfo.GetLineCap();
- maDash = XDash(css::drawing::DashStyle_RECT,
- rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
- rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
- rLineInfo.GetDistance());
- SetAttributes(pPath);
- mnLineWidth = 0;
- maLineJoin = basegfx::B2DLineJoin::NONE;
- maDash = XDash();
- InsertObj(pPath, false);
- }
+ if(mbLastObjWasLine && (nNewLineWidth == mnLineWidth) && CheckLastLineMerge(aLine))
+ {
+ bCreateLineObject = false;
}
+
+ if(!bCreateLineObject)
+ return;
+
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_LINE,
+ basegfx::B2DPolyPolygon(aLine));
+ mnLineWidth = nNewLineWidth;
+ maLineJoin = rLineInfo.GetLineJoin();
+ maLineCap = rLineInfo.GetLineCap();
+ maDash = XDash(css::drawing::DashStyle_RECT,
+ rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
+ rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
+ rLineInfo.GetDistance());
+ SetAttributes(pPath);
+ mnLineWidth = 0;
+ maLineJoin = basegfx::B2DLineJoin::NONE;
+ maDash = XDash();
+ InsertObj(pPath, false);
}
void ImpSdrGDIMetaFileImport::DoAction(MetaRectAction const & rAct)
@@ -883,21 +883,21 @@ bool ImpSdrGDIMetaFileImport::CheckLastPolyLineAndFillMerge(const basegfx::B2DPo
void ImpSdrGDIMetaFileImport::checkClip()
{
- if(mpVD->IsClipRegion())
- {
- maClip = mpVD->GetClipRegion().GetAsB2DPolyPolygon();
+ if(!mpVD->IsClipRegion())
+ return;
- if(isClip())
- {
- const basegfx::B2DHomMatrix aTransform(
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- mfScaleX,
- mfScaleY,
- maOfs.X(),
- maOfs.Y()));
-
- maClip.transform(aTransform);
- }
+ maClip = mpVD->GetClipRegion().GetAsB2DPolyPolygon();
+
+ if(isClip())
+ {
+ const basegfx::B2DHomMatrix aTransform(
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ mfScaleX,
+ mfScaleY,
+ maOfs.X(),
+ maOfs.Y()));
+
+ maClip.transform(aTransform);
}
}
@@ -930,25 +930,25 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction const & rAct )
bCreateLineObject = false;
}
- if(bCreateLineObject)
- {
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
- basegfx::B2DPolyPolygon(aSource));
- mnLineWidth = nNewLineWidth;
- maLineJoin = rLineInfo.GetLineJoin();
- maLineCap = rLineInfo.GetLineCap();
- maDash = XDash(css::drawing::DashStyle_RECT,
- rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
- rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
- rLineInfo.GetDistance());
- SetAttributes(pPath);
- mnLineWidth = 0;
- maLineJoin = basegfx::B2DLineJoin::NONE;
- maDash = XDash();
- InsertObj(pPath, false);
- }
+ if(!bCreateLineObject)
+ return;
+
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ aSource.isClosed() ? OBJ_POLY : OBJ_PLIN,
+ basegfx::B2DPolyPolygon(aSource));
+ mnLineWidth = nNewLineWidth;
+ maLineJoin = rLineInfo.GetLineJoin();
+ maLineCap = rLineInfo.GetLineCap();
+ maDash = XDash(css::drawing::DashStyle_RECT,
+ rLineInfo.GetDotCount(), rLineInfo.GetDotLen(),
+ rLineInfo.GetDashCount(), rLineInfo.GetDashLen(),
+ rLineInfo.GetDistance());
+ SetAttributes(pPath);
+ mnLineWidth = 0;
+ maLineJoin = basegfx::B2DLineJoin::NONE;
+ maDash = XDash();
+ InsertObj(pPath, false);
}
void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction const & rAct )
@@ -956,22 +956,22 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolygonAction const & rAct )
// #i73407# reformulation to use new B2DPolygon classes
basegfx::B2DPolygon aSource(rAct.GetPolygon().getB2DPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
+ if(!aSource.count())
+ return;
- if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
- {
- // #i73407# make sure polygon is closed, it's a filled primitive
- aSource.setClosed(true);
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- basegfx::B2DPolyPolygon(aSource));
- SetAttributes(pPath);
- InsertObj(pPath, false);
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))
+ {
+ // #i73407# make sure polygon is closed, it's a filled primitive
+ aSource.setClosed(true);
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ basegfx::B2DPolyPolygon(aSource));
+ SetAttributes(pPath);
+ InsertObj(pPath, false);
}
}
@@ -980,22 +980,22 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaPolyPolygonAction const & rAct)
// #i73407# reformulation to use new B2DPolygon classes
basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
+ if(!aSource.count())
+ return;
- if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
- {
- // #i73407# make sure polygon is closed, it's a filled primitive
- aSource.setClosed(true);
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- aSource);
- SetAttributes(pPath);
- InsertObj(pPath, false);
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
+ {
+ // #i73407# make sure polygon is closed, it's a filled primitive
+ aSource.setClosed(true);
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ aSource);
+ SetAttributes(pPath);
+ InsertObj(pPath, false);
}
}
@@ -1152,51 +1152,51 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaHatchAction const & rAct )
// #i73407# reformulation to use new B2DPolygon classes
basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
+ if(!aSource.count())
+ return;
- if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
- {
- const Hatch& rHatch = rAct.GetHatch();
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- aSource);
- // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
- SfxItemSet aHatchAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
- css::drawing::HatchStyle eStyle;
-
- switch(rHatch.GetStyle())
- {
- case HatchStyle::Triple :
- {
- eStyle = css::drawing::HatchStyle_TRIPLE;
- break;
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
- case HatchStyle::Double :
- {
- eStyle = css::drawing::HatchStyle_DOUBLE;
- break;
- }
+ if(mbLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(aSource))
+ return;
- default:
- {
- eStyle = css::drawing::HatchStyle_SINGLE;
- break;
- }
- }
+ const Hatch& rHatch = rAct.GetHatch();
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ aSource);
+ // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
+ SfxItemSet aHatchAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
+ css::drawing::HatchStyle eStyle;
- SetAttributes(pPath);
- aHatchAttr.Put(XFillStyleItem(drawing::FillStyle_HATCH));
- aHatchAttr.Put(XFillHatchItem(XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle())));
- pPath->SetMergedItemSet(aHatchAttr);
+ switch(rHatch.GetStyle())
+ {
+ case HatchStyle::Triple :
+ {
+ eStyle = css::drawing::HatchStyle_TRIPLE;
+ break;
+ }
+
+ case HatchStyle::Double :
+ {
+ eStyle = css::drawing::HatchStyle_DOUBLE;
+ break;
+ }
- InsertObj(pPath, false);
+ default:
+ {
+ eStyle = css::drawing::HatchStyle_SINGLE;
+ break;
}
}
+
+ SetAttributes(pPath);
+ aHatchAttr.Put(XFillStyleItem(drawing::FillStyle_HATCH));
+ aHatchAttr.Put(XFillHatchItem(XHatch(rHatch.GetColor(), eStyle, rHatch.GetDistance(), rHatch.GetAngle())));
+ pPath->SetMergedItemSet(aHatchAttr);
+
+ InsertObj(pPath, false);
}
@@ -1479,62 +1479,62 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaTransparentAction const & rAct)
{
basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
- aSource.setClosed(true);
+ if(!aSource.count())
+ return;
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- aSource);
- SetAttributes(pPath);
- pPath->SetMergedItem(XFillTransparenceItem(rAct.GetTransparence()));
- InsertObj(pPath, false);
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
+ aSource.setClosed(true);
+
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ aSource);
+ SetAttributes(pPath);
+ pPath->SetMergedItem(XFillTransparenceItem(rAct.GetTransparence()));
+ InsertObj(pPath, false);
}
void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction const & rAct)
{
basegfx::B2DPolyPolygon aSource(rAct.GetPolyPolygon().getB2DPolyPolygon());
- if(aSource.count())
- {
- const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
- aSource.transform(aTransform);
+ if(!aSource.count())
+ return;
- if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(aSource))
- {
- const Gradient& rGradient = rAct.GetGradient();
- SdrPathObj* pPath = new SdrPathObj(
- *mpModel,
- OBJ_POLY,
- aSource);
- // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
- SfxItemSet aGradientAttr(mpModel->GetItemPool(), pPath->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(pPath);
- aGradientAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // #i125211#
- aGradientAttr.Put(aXFillGradientItem);
- pPath->SetMergedItemSet(aGradientAttr);
-
- InsertObj(pPath, false);
- }
- }
+ const basegfx::B2DHomMatrix aTransform(basegfx::utils::createScaleTranslateB2DHomMatrix(mfScaleX, mfScaleY, maOfs.X(), maOfs.Y()));
+ aSource.transform(aTransform);
+
+ if(mbLastObjWasPolyWithoutLine && CheckLastPolyLineAndFillMerge(aSource))
+ return;
+
+ const Gradient& rGradient = rAct.GetGradient();
+ SdrPathObj* pPath = new SdrPathObj(
+ *mpModel,
+ OBJ_POLY,
+ aSource);
+ // #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
+ SfxItemSet aGradientAttr(mpModel->GetItemPool(), pPath->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(pPath);
+ aGradientAttr.Put(XFillStyleItem(drawing::FillStyle_GRADIENT)); // #i125211#
+ aGradientAttr.Put(aXFillGradientItem);
+ pPath->SetMergedItemSet(aGradientAttr);
+
+ InsertObj(pPath, false);
}
void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
@@ -1609,41 +1609,41 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct)
bHasNewMask = true;
}
- if(bCreateObject)
+ if(!bCreateObject)
+ return;
+
+ 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));
-
- aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha);
- }
+ sal_uInt8 aAlpha(basegfx::fround(fTransparence * 255.0));
- aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask);
+ aNewMask = AlphaMask(aBitmapEx.GetBitmap().GetSizePixel(), &aAlpha);
}
- else
- {
- vcl::bitmap::DrawAlphaBitmapAndAlphaGradient(aBitmapEx, bFixedTransparence, fTransparence, aNewMask);
- }
- }
- // create and add object
- SdrGrafObj* pGraf = new SdrGrafObj(
- *mpModel,
- 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);
+ aBitmapEx = BitmapEx(aBitmapEx.GetBitmap(), aNewMask);
+ }
+ else
+ {
+ vcl::bitmap::DrawAlphaBitmapAndAlphaGradient(aBitmapEx, bFixedTransparence, fTransparence, aNewMask);
+ }
}
+
+ // create and add object
+ SdrGrafObj* pGraf = new SdrGrafObj(
+ *mpModel,
+ 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);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index 444517a97ca3..5f81d38575ab 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -169,23 +169,24 @@ static void ImpGetAlign(SdrGluePoint & rGP, const SdrObject* /*pObj*/, const voi
SdrAlign& nRet=*const_cast<SdrAlign *>(static_cast<SdrAlign const *>(pnRet));
bool& bDontCare=*const_cast<bool *>(static_cast<bool const *>(pbDontCare));
bool bVert=*static_cast<bool const *>(pbVert);
- if (!bDontCare) {
- SdrAlign nAlg=SdrAlign::NONE;
+ if (bDontCare)
+ return;
+
+ SdrAlign nAlg=SdrAlign::NONE;
+ if (bVert) {
+ nAlg=rGP.GetVertAlign();
+ } else {
+ nAlg=rGP.GetHorzAlign();
+ }
+ bool& bFirst=*const_cast<bool *>(static_cast<bool const *>(pbFirst));
+ if (bFirst) { nRet=nAlg; bFirst=false; }
+ else if (nRet!=nAlg) {
if (bVert) {
- nAlg=rGP.GetVertAlign();
+ nRet=SdrAlign::VERT_DONTCARE;
} else {
- nAlg=rGP.GetHorzAlign();
- }
- bool& bFirst=*const_cast<bool *>(static_cast<bool const *>(pbFirst));
- if (bFirst) { nRet=nAlg; bFirst=false; }
- else if (nRet!=nAlg) {
- if (bVert) {
- nRet=SdrAlign::VERT_DONTCARE;
- } else {
- nRet=SdrAlign::HORZ_DONTCARE;
- }
- bDontCare=true;
+ nRet=SdrAlign::HORZ_DONTCARE;
}
+ bDontCare=true;
}
}
diff --git a/svx/source/svdraw/svdglue.cxx b/svx/source/svdraw/svdglue.cxx
index 784b3d8bfdc2..a662b99bfe0b 100644
--- a/svx/source/svdraw/svdglue.cxx
+++ b/svx/source/svdraw/svdglue.cxx
@@ -28,20 +28,20 @@ const Size aGlueHalfSize(4,4);
void SdrGluePoint::SetReallyAbsolute(bool bOn, const SdrObject& rObj)
{
- if ( bReallyAbsolute != bOn )
- {
- if ( bOn )
- {
- aPos=GetAbsolutePos(rObj);
- bReallyAbsolute=bOn;
- }
- else
- {
- bReallyAbsolute=bOn;
- Point aPt(aPos);
- SetAbsolutePos(aPt,rObj);
- }
- }
+ if ( bReallyAbsolute == bOn )
+ return;
+
+ if ( bOn )
+ {
+ aPos=GetAbsolutePos(rObj);
+ bReallyAbsolute=bOn;
+ }
+ else
+ {
+ bReallyAbsolute=bOn;
+ Point aPt(aPos);
+ SetAbsolutePos(aPt,rObj);
+ }
}
Point SdrGluePoint::GetAbsolutePos(const SdrObject& rObj) const
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index fab9f7b03d73..bbd2926d36ab 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -404,223 +404,223 @@ void SdrHdl::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
+ if(!pHdlList || !pHdlList->GetView() || pHdlList->GetView()->areMarkHandlesHidden())
+ return;
+
+ BitmapColorIndex eColIndex = BitmapColorIndex::LightGreen;
+ BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_7x7;
+
+ bool bRot = pHdlList->IsRotateShear();
+ if(pObj)
+ eColIndex = bSelect ? BitmapColorIndex::Cyan : BitmapColorIndex::LightCyan;
+ if(bRot)
{
- BitmapColorIndex eColIndex = BitmapColorIndex::LightGreen;
- BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_7x7;
+ // red rotation handles
+ if(pObj && bSelect)
+ eColIndex = BitmapColorIndex::Red;
+ else
+ eColIndex = BitmapColorIndex::LightRed;
+ }
- bool bRot = pHdlList->IsRotateShear();
- if(pObj)
- eColIndex = bSelect ? BitmapColorIndex::Cyan : BitmapColorIndex::LightCyan;
- if(bRot)
+ switch(eKind)
+ {
+ case SdrHdlKind::Move:
{
- // red rotation handles
- if(pObj && bSelect)
- eColIndex = BitmapColorIndex::Red;
- else
- eColIndex = BitmapColorIndex::LightRed;
+ eKindOfMarker = b1PixMore ? BitmapMarkerKind::Rect_9x9 : BitmapMarkerKind::Rect_7x7;
+ break;
}
-
- switch(eKind)
+ case SdrHdlKind::UpperLeft:
+ case SdrHdlKind::UpperRight:
+ case SdrHdlKind::LowerLeft:
+ case SdrHdlKind::LowerRight:
{
- case SdrHdlKind::Move:
- {
- eKindOfMarker = b1PixMore ? BitmapMarkerKind::Rect_9x9 : BitmapMarkerKind::Rect_7x7;
- break;
- }
- case SdrHdlKind::UpperLeft:
- case SdrHdlKind::UpperRight:
- case SdrHdlKind::LowerLeft:
- case SdrHdlKind::LowerRight:
- {
- // corner handles
- if(bRot)
- {
- eKindOfMarker = BitmapMarkerKind::Circ_7x7;
- }
- else
- {
- eKindOfMarker = BitmapMarkerKind::Rect_7x7;
- }
- break;
- }
- case SdrHdlKind::Upper:
- case SdrHdlKind::Lower:
- {
- // Upper/Lower handles
- if(bRot)
- {
- eKindOfMarker = BitmapMarkerKind::Elli_9x7;
- }
- else
- {
- eKindOfMarker = BitmapMarkerKind::Rect_7x7;
- }
- break;
- }
- case SdrHdlKind::Left:
- case SdrHdlKind::Right:
- {
- // Left/Right handles
- if(bRot)
- {
- eKindOfMarker = BitmapMarkerKind::Elli_7x9;
- }
- else
- {
- eKindOfMarker = BitmapMarkerKind::Rect_7x7;
- }
- break;
- }
- case SdrHdlKind::Poly:
- {
- if(bRot)
- {
- eKindOfMarker = b1PixMore ? BitmapMarkerKind::Circ_9x9 : BitmapMarkerKind::Circ_7x7;
- }
- else
- {
- eKindOfMarker = b1PixMore ? BitmapMarkerKind::Rect_9x9 : BitmapMarkerKind::Rect_7x7;
- }
- break;
- }
- case SdrHdlKind::BezierWeight: // weight at poly
+ // corner handles
+ if(bRot)
{
eKindOfMarker = BitmapMarkerKind::Circ_7x7;
- break;
}
- case SdrHdlKind::Circle:
+ else
{
- eKindOfMarker = BitmapMarkerKind::Rect_11x11;
- break;
+ eKindOfMarker = BitmapMarkerKind::Rect_7x7;
}
- case SdrHdlKind::Ref1:
- case SdrHdlKind::Ref2:
+ break;
+ }
+ case SdrHdlKind::Upper:
+ case SdrHdlKind::Lower:
+ {
+ // Upper/Lower handles
+ if(bRot)
{
- eKindOfMarker = BitmapMarkerKind::Crosshair;
- break;
+ eKindOfMarker = BitmapMarkerKind::Elli_9x7;
}
- case SdrHdlKind::Glue:
+ else
{
- eKindOfMarker = BitmapMarkerKind::Glue;
- break;
+ eKindOfMarker = BitmapMarkerKind::Rect_7x7;
}
- case SdrHdlKind::Anchor:
+ break;
+ }
+ case SdrHdlKind::Left:
+ case SdrHdlKind::Right:
+ {
+ // Left/Right handles
+ if(bRot)
{
- eKindOfMarker = BitmapMarkerKind::Anchor;
- break;
+ eKindOfMarker = BitmapMarkerKind::Elli_7x9;
}
- case SdrHdlKind::User:
+ else
{
- break;
+ eKindOfMarker = BitmapMarkerKind::Rect_7x7;
}
- // top right anchor for SW
- case SdrHdlKind::Anchor_TR:
+ break;
+ }
+ case SdrHdlKind::Poly:
+ {
+ if(bRot)
{
- eKindOfMarker = BitmapMarkerKind::AnchorTR;
- break;
+ eKindOfMarker = b1PixMore ? BitmapMarkerKind::Circ_9x9 : BitmapMarkerKind::Circ_7x7;
}
-
- // for SJ and the CustomShapeHandles:
- case SdrHdlKind::CustomShape1:
+ else
{
- eKindOfMarker = b1PixMore ? BitmapMarkerKind::Customshape_9x9 : BitmapMarkerKind::Customshape_7x7;
- eColIndex = BitmapColorIndex::Yellow;
- break;
+ eKindOfMarker = b1PixMore ? BitmapMarkerKind::Rect_9x9 : BitmapMarkerKind::Rect_7x7;
}
- default:
- break;
+ break;
+ }
+ case SdrHdlKind::BezierWeight: // weight at poly
+ {
+ eKindOfMarker = BitmapMarkerKind::Circ_7x7;
+ break;
+ }
+ case SdrHdlKind::Circle:
+ {
+ eKindOfMarker = BitmapMarkerKind::Rect_11x11;
+ break;
+ }
+ case SdrHdlKind::Ref1:
+ case SdrHdlKind::Ref2:
+ {
+ eKindOfMarker = BitmapMarkerKind::Crosshair;
+ break;
}
+ case SdrHdlKind::Glue:
+ {
+ eKindOfMarker = BitmapMarkerKind::Glue;
+ break;
+ }
+ case SdrHdlKind::Anchor:
+ {
+ eKindOfMarker = BitmapMarkerKind::Anchor;
+ break;
+ }
+ case SdrHdlKind::User:
+ {
+ break;
+ }
+ // top right anchor for SW
+ case SdrHdlKind::Anchor_TR:
+ {
+ eKindOfMarker = BitmapMarkerKind::AnchorTR;
+ break;
+ }
+
+ // for SJ and the CustomShapeHandles:
+ case SdrHdlKind::CustomShape1:
+ {
+ eKindOfMarker = b1PixMore ? BitmapMarkerKind::Customshape_9x9 : BitmapMarkerKind::Customshape_7x7;
+ eColIndex = BitmapColorIndex::Yellow;
+ break;
+ }
+ default:
+ break;
+ }
+
+ SdrMarkView* pView = pHdlList->GetView();
+ SdrPageView* pPageView = pView->GetSdrPageView();
- SdrMarkView* pView = pHdlList->GetView();
- SdrPageView* pPageView = pView->GetSdrPageView();
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ {
+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pPageView)
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ Point aMoveOutsideOffset(0, 0);
+ OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
+
+ // add offset if necessary
+ if(pHdlList->IsMoveOutside() || mbMoveOutside)
{
- // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
+
+ if(eKind == SdrHdlKind::UpperLeft || eKind == SdrHdlKind::Upper || eKind == SdrHdlKind::UpperRight)
+ aMoveOutsideOffset.AdjustY( -(aOffset.Width()) );
+ if(eKind == SdrHdlKind::LowerLeft || eKind == SdrHdlKind::Lower || eKind == SdrHdlKind::LowerRight)
+ aMoveOutsideOffset.AdjustY(aOffset.Height() );
+ if(eKind == SdrHdlKind::UpperLeft || eKind == SdrHdlKind::Left || eKind == SdrHdlKind::LowerLeft)
+ aMoveOutsideOffset.AdjustX( -(aOffset.Width()) );
+ if(eKind == SdrHdlKind::UpperRight || eKind == SdrHdlKind::Right || eKind == SdrHdlKind::LowerRight)
+ aMoveOutsideOffset.AdjustX(aOffset.Height() );
+ }
- if(rPageWindow.GetPaintWindow().OutputToWindow())
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
+ {
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject;
+ if (getenv ("SVX_DRAW_HANDLES") && (eKindOfMarker == BitmapMarkerKind::Rect_7x7 || eKindOfMarker == BitmapMarkerKind::Rect_9x9 || eKindOfMarker == BitmapMarkerKind::Rect_11x11))
{
- Point aMoveOutsideOffset(0, 0);
- OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
-
- // add offset if necessary
- if(pHdlList->IsMoveOutside() || mbMoveOutside)
+ double fSize = 7.0;
+ switch (eKindOfMarker)
{
- Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
-
- if(eKind == SdrHdlKind::UpperLeft || eKind == SdrHdlKind::Upper || eKind == SdrHdlKind::UpperRight)
- aMoveOutsideOffset.AdjustY( -(aOffset.Width()) );
- if(eKind == SdrHdlKind::LowerLeft || eKind == SdrHdlKind::Lower || eKind == SdrHdlKind::LowerRight)
- aMoveOutsideOffset.AdjustY(aOffset.Height() );
- if(eKind == SdrHdlKind::UpperLeft || eKind == SdrHdlKind::Left || eKind == SdrHdlKind::LowerLeft)
- aMoveOutsideOffset.AdjustX( -(aOffset.Width()) );
- if(eKind == SdrHdlKind::UpperRight || eKind == SdrHdlKind::Right || eKind == SdrHdlKind::LowerRight)
- aMoveOutsideOffset.AdjustX(aOffset.Height() );
+ case BitmapMarkerKind::Rect_9x9:
+ fSize = 9.0;
+ break;
+ case BitmapMarkerKind::Rect_11x11:
+ fSize = 11.0;
+ break;
+ default:
+ break;
}
+ float fScalingFactor = rOutDev.GetDPIScaleFactor();
+ basegfx::B2DSize aB2DSize(fSize * fScalingFactor, fSize * fScalingFactor);
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
+ Color aHandleFillColor(COL_LIGHTGREEN);
+ switch (eColIndex)
{
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject;
- if (getenv ("SVX_DRAW_HANDLES") && (eKindOfMarker == BitmapMarkerKind::Rect_7x7 || eKindOfMarker == BitmapMarkerKind::Rect_9x9 || eKindOfMarker == BitmapMarkerKind::Rect_11x11))
- {
- double fSize = 7.0;
- switch (eKindOfMarker)
- {
- case BitmapMarkerKind::Rect_9x9:
- fSize = 9.0;
- break;
- case BitmapMarkerKind::Rect_11x11:
- fSize = 11.0;
- break;
- default:
- break;
- }
- float fScalingFactor = rOutDev.GetDPIScaleFactor();
- basegfx::B2DSize aB2DSize(fSize * fScalingFactor, fSize * fScalingFactor);
-
- Color aHandleFillColor(COL_LIGHTGREEN);
- switch (eColIndex)
- {
- case BitmapColorIndex::Cyan:
- aHandleFillColor = COL_CYAN;
- break;
- case BitmapColorIndex::LightCyan:
- aHandleFillColor = COL_LIGHTCYAN;
- break;
- case BitmapColorIndex::Red:
- aHandleFillColor = COL_RED;
- break;
- case BitmapColorIndex::LightRed:
- aHandleFillColor = COL_LIGHTRED;
- break;
- case BitmapColorIndex::Yellow:
- aHandleFillColor = COL_YELLOW;
- break;
- default:
- break;
- }
- pNewOverlayObject.reset(new sdr::overlay::OverlayHandle(aPosition, aB2DSize, /*HandleStrokeColor*/COL_BLACK, aHandleFillColor));
- }
- else
- {
- pNewOverlayObject = CreateOverlayObject(
- aPosition, eColIndex, eKindOfMarker,
- aMoveOutsideOffset);
- }
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
+ case BitmapColorIndex::Cyan:
+ aHandleFillColor = COL_CYAN;
+ break;
+ case BitmapColorIndex::LightCyan:
+ aHandleFillColor = COL_LIGHTCYAN;
+ break;
+ case BitmapColorIndex::Red:
+ aHandleFillColor = COL_RED;
+ break;
+ case BitmapColorIndex::LightRed:
+ aHandleFillColor = COL_LIGHTRED;
+ break;
+ case BitmapColorIndex::Yellow:
+ aHandleFillColor = COL_YELLOW;
+ break;
+ default:
+ break;
}
+ pNewOverlayObject.reset(new sdr::overlay::OverlayHandle(aPosition, aB2DSize, /*HandleStrokeColor*/COL_BLACK, aHandleFillColor));
}
+ else
+ {
+ pNewOverlayObject = CreateOverlayObject(
+ aPosition, eColIndex, eKindOfMarker,
+ aMoveOutsideOffset);
+ }
+
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1129,43 +1129,43 @@ void SdrHdlColor::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ BitmapEx aBmpCol(CreateColorDropper(aMarkerColor));
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayBitmapEx(
+ aPosition,
+ aBmpCol,
+ static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Width() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Height() - 1) >> 1
+ ));
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- BitmapEx aBmpCol(CreateColorDropper(aMarkerColor));
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayBitmapEx(
- aPosition,
- aBmpCol,
- static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Width() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Height() - 1) >> 1
- ));
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1281,78 +1281,78 @@ void SdrHdlGradient::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ // striped line in between
+ basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
+ double fVecLen = aVec.getLength();
+ double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
+ double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
+ aVec.normalize();
+ basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
+ sal_Int32 nMidX = static_cast<sal_Int32>(aPos.X() + aVec.getX() * fLongPercentArrow);
+ sal_Int32 nMidY = static_cast<sal_Int32>(aPos.Y() + aVec.getY() * fLongPercentArrow);
+ Point aMidPoint(nMidX, nMidY);
+
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
+
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayLineStriped(
+ aPosition, aMidPos
+ ));
+
+ pNewOverlayObject->setBaseColor(IsGradient() ? COL_BLACK : COL_BLUE);
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- // striped line in between
- basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
- double fVecLen = aVec.getLength();
- double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
- double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
- aVec.normalize();
- basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
- sal_Int32 nMidX = static_cast<sal_Int32>(aPos.X() + aVec.getX() * fLongPercentArrow);
- sal_Int32 nMidY = static_cast<sal_Int32>(aPos.Y() + aVec.getY() * fLongPercentArrow);
- Point aMidPoint(nMidX, nMidY);
-
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
-
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayLineStriped(
- aPosition, aMidPos
- ));
-
- pNewOverlayObject->setBaseColor(IsGradient() ? COL_BLACK : COL_BLUE);
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
-
- // arrowhead
- Point aLeft(aMidPoint.X() + static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
- aMidPoint.Y() + static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
- Point aRight(aMidPoint.X() - static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
- aMidPoint.Y() - static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
-
- basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
- basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
- basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
-
- pNewOverlayObject.reset(new
- sdr::overlay::OverlayTriangle(
- aPositionLeft,
- aPosition2,
- aPositionRight,
- IsGradient() ? COL_BLACK : COL_BLUE
- ));
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
+
+ // arrowhead
+ Point aLeft(aMidPoint.X() + static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
+ aMidPoint.Y() + static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
+ Point aRight(aMidPoint.X() - static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth),
+ aMidPoint.Y() - static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth));
+
+ basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
+ basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
+ basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
+
+ pNewOverlayObject.reset(new
+ sdr::overlay::OverlayTriangle(
+ aPositionLeft,
+ aPosition2,
+ aPositionRight,
+ IsGradient() ? COL_BLACK : COL_BLUE
+ ));
+
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1443,45 +1443,45 @@ void SdrHdlLine::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2)
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
+ basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
- basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
-
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayLineStriped(
- aPosition1,
- aPosition2
- ));
-
- // color(?)
- pNewOverlayObject->setBaseColor(COL_LIGHTRED);
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayLineStriped(
+ aPosition1,
+ aPosition2
+ ));
+
+ // color(?)
+ pNewOverlayObject->setBaseColor(COL_LIGHTRED);
+
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1501,50 +1501,50 @@ void SdrHdlBezWgt::CreateB2dIAObject()
SdrHdl::CreateB2dIAObject();
// create lines
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
-
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
- basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
+ basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
+ basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
- if(!aPosition1.equal(aPosition2))
- {
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayLineStriped(
- aPosition1,
- aPosition2
- ));
+ if(!aPosition1.equal(aPosition2))
+ {
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayLineStriped(
+ aPosition1,
+ aPosition2
+ ));
- // line part is not hittable
- pNewOverlayObject->setHittable(false);
+ // line part is not hittable
+ pNewOverlayObject->setHittable(false);
- // color(?)
- pNewOverlayObject->setBaseColor(COL_LIGHTBLUE);
+ // color(?)
+ pNewOverlayObject->setBaseColor(COL_LIGHTBLUE);
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1560,39 +1560,39 @@ E3dVolumeMarker::E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly)
void E3dVolumeMarker::CreateB2dIAObject()
{
// create lines
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is() && aWireframePoly.count())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
-
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is() && aWireframePoly.count())
- {
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
- sdr::overlay::OverlayPolyPolygonStripedAndFilled(
- aWireframePoly));
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(new
+ sdr::overlay::OverlayPolyPolygonStripedAndFilled(
+ aWireframePoly));
- pNewOverlayObject->setBaseColor(COL_BLACK);
+ pNewOverlayObject->setBaseColor(COL_BLACK);
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1726,52 +1726,52 @@ void ImpMeasureHdl::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan;
+ BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_9x9;
+
+ if(nObjHdlNum > 1)
{
- SdrMarkView* pView = pHdlList->GetView();
+ eKindOfMarker = BitmapMarkerKind::Rect_7x7;
+ }
- if(pView && !pView->areMarkHandlesHidden())
- {
- BitmapColorIndex eColIndex = BitmapColorIndex::LightCyan;
- BitmapMarkerKind eKindOfMarker = BitmapMarkerKind::Rect_9x9;
+ if(bSelect)
+ {
+ eColIndex = BitmapColorIndex::Cyan;
+ }
- if(nObjHdlNum > 1)
- {
- eKindOfMarker = BitmapMarkerKind::Rect_7x7;
- }
+ SdrPageView* pPageView = pView->GetSdrPageView();
- if(bSelect)
- {
- eColIndex = BitmapColorIndex::Cyan;
- }
+ if(!pPageView)
+ return;
- SdrPageView* pPageView = pView->GetSdrPageView();
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pPageView)
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(CreateOverlayObject(
+ aPosition,
+ eColIndex,
+ eKindOfMarker));
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- std::unique_ptr<sdr::overlay::OverlayObject> pNewOverlayObject(CreateOverlayObject(
- aPosition,
- eColIndex,
- eKindOfMarker));
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -1800,51 +1800,51 @@ void ImpTextframeHdl::CreateB2dIAObject()
// first throw away old one
GetRidOfIAObject();
- if(pHdlList)
+ if(!pHdlList)
+ return;
+
+ SdrMarkView* pView = pHdlList->GetView();
+
+ if(!(pView && !pView->areMarkHandlesHidden()))
+ return;
+
+ SdrPageView* pPageView = pView->GetSdrPageView();
+
+ if(!pPageView)
+ return;
+
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
{
- SdrMarkView* pView = pHdlList->GetView();
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- if(pView && !pView->areMarkHandlesHidden())
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
{
- SdrPageView* pPageView = pView->GetSdrPageView();
-
- if(pPageView)
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
{
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
+ const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
+ const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
+
+ std::unique_ptr<sdr::overlay::OverlayRectangle> pNewOverlayObject(new sdr::overlay::OverlayRectangle(
+ aTopLeft,
+ aBottomRight,
+ aHilightColor,
+ fTransparence,
+ 3.0,
+ 3.0,
+ nRotationAngle * -F_PI18000,
+ true)); // allow animation; the Handle is not shown at text edit time
+
+ pNewOverlayObject->setHittable(false);
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
- const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
- const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
-
- std::unique_ptr<sdr::overlay::OverlayRectangle> pNewOverlayObject(new sdr::overlay::OverlayRectangle(
- aTopLeft,
- aBottomRight,
- aHilightColor,
- fTransparence,
- 3.0,
- 3.0,
- nRotationAngle * -F_PI18000,
- true)); // allow animation; the Handle is not shown at text edit time
-
- pNewOverlayObject->setHittable(false);
-
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pNewOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
- }
- }
- }
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pNewOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
@@ -2138,26 +2138,26 @@ SdrHdl* SdrHdlList::GetFocusHdl() const
void SdrHdlList::SetFocusHdl(SdrHdl* pNew)
{
- if(pNew)
- {
- SdrHdl* pActual = GetFocusHdl();
+ if(!pNew)
+ return;
- if(!pActual || pActual != pNew)
- {
- const size_t nNewHdlNum = GetHdlNum(pNew);
+ SdrHdl* pActual = GetFocusHdl();
- if(nNewHdlNum != SAL_MAX_SIZE)
- {
- mnFocusIndex = nNewHdlNum;
+ if(pActual && pActual == pNew)
+ return;
- if(pActual)
- {
- pActual->Touch();
- }
+ const size_t nNewHdlNum = GetHdlNum(pNew);
- pNew->Touch();
- }
+ if(nNewHdlNum != SAL_MAX_SIZE)
+ {
+ mnFocusIndex = nNewHdlNum;
+
+ if(pActual)
+ {
+ pActual->Touch();
}
+
+ pNew->Touch();
}
}
@@ -2264,18 +2264,17 @@ void SdrHdlList::Sort()
// get now and compare
SdrHdl* pNow = GetFocusHdl();
- if(pPrev != pNow)
- {
+ if(pPrev == pNow)
+ return;
- if(pPrev)
- {
- pPrev->Touch();
- }
+ if(pPrev)
+ {
+ pPrev->Touch();
+ }
- if(pNow)
- {
- pNow->Touch();
- }
+ if(pNow)
+ {
+ pNow->Touch();
}
}
@@ -2395,68 +2394,68 @@ void SdrCropHdl::CreateB2dIAObject()
SdrMarkView* pView = pHdlList ? pHdlList->GetView() : nullptr;
SdrPageView* pPageView = pView ? pView->GetSdrPageView() : nullptr;
- if( pPageView && !pView->areMarkHandlesHidden() )
- {
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- int nHdlSize = pHdlList->GetHdlSize();
+ if( !(pPageView && !pView->areMarkHandlesHidden()) )
+ return;
- const BitmapEx aHandlesBitmap(SIP_SA_CROP_MARKERS);
- BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ int nHdlSize = pHdlList->GetHdlSize();
- for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
- {
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+ const BitmapEx aHandlesBitmap(SIP_SA_CROP_MARKERS);
+ BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
- if (xManager.is())
- {
- basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
+ for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
+ {
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
- std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+ if (xManager.is())
+ {
+ basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- // animate focused handles
- if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
- {
- if( nHdlSize >= 2 )
- nHdlSize = 1;
-
- BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
-
- const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
-
- pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(
- aPosition,
- aBmpEx1,
- aBmpEx2,
- nBlinkTime,
- static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
- mfShearX,
- mfRotation));
- }
- else
- {
- // create centered handle as default
- pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx(
- aPosition,
- aBmpEx1,
- static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
- static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
- 0.0,
- mfShearX,
- mfRotation));
- }
+ std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
- // OVERLAYMANAGER
- insertNewlyCreatedOverlayObjectForSdrHdl(
- std::move(pOverlayObject),
- rPageWindow.GetObjectContact(),
- *xManager);
+ // animate focused handles
+ if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
+ {
+ if( nHdlSize >= 2 )
+ nHdlSize = 1;
+
+ BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
+
+ const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
+
+ pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(
+ aPosition,
+ aBmpEx1,
+ aBmpEx2,
+ nBlinkTime,
+ static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
+ mfShearX,
+ mfRotation));
+ }
+ else
+ {
+ // create centered handle as default
+ pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx(
+ aPosition,
+ aBmpEx1,
+ static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
+ 0.0,
+ mfShearX,
+ mfRotation));
}
+
+ // OVERLAYMANAGER
+ insertNewlyCreatedOverlayObjectForSdrHdl(
+ std::move(pOverlayObject),
+ rPageWindow.GetObjectContact(),
+ *xManager);
}
}
}
diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx
index d70b221ba626..c9ca7041f261 100644
--- a/svx/source/svdraw/svdlayer.cxx
+++ b/svx/source/svdraw/svdlayer.cxx
@@ -46,22 +46,22 @@ void SdrLayerIDSet::operator&=(const SdrLayerIDSet& r2ndSet)
void SdrLayerIDSet::PutValue( const css::uno::Any & rAny )
{
css::uno::Sequence< sal_Int8 > aSeq;
- if( rAny >>= aSeq )
- {
- sal_Int16 nCount = static_cast<sal_Int16>(aSeq.getLength());
- if( nCount > 32 )
- nCount = 32;
+ if( !(rAny >>= aSeq) )
+ return;
- sal_Int16 nIndex;
- for( nIndex = 0; nIndex < nCount; nIndex++ )
- {
- aData[nIndex] = static_cast<sal_uInt8>(aSeq[nIndex]);
- }
+ sal_Int16 nCount = static_cast<sal_Int16>(aSeq.getLength());
+ if( nCount > 32 )
+ nCount = 32;
- for( ; nIndex < 32; nIndex++ )
- {
- aData[nIndex] = 0;
- }
+ sal_Int16 nIndex;
+ for( nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ aData[nIndex] = static_cast<sal_uInt8>(aSeq[nIndex]);
+ }
+
+ for( ; nIndex < 32; nIndex++ )
+ {
+ aData[nIndex] = 0;
}
}
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 3b5988974d18..866de4920c15 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -148,51 +148,51 @@ void SdrMarkList::ForceSort() const
void SdrMarkList::ImpForceSort()
{
- if(!mbSorted)
+ if(mbSorted)
+ return;
+
+ mbSorted = true;
+ size_t nCount = maList.size();
+
+ // remove invalid
+ if(nCount > 0 )
{
- mbSorted = true;
- size_t nCount = maList.size();
+ maList.erase(std::remove_if(maList.begin(), maList.end(),
+ [](std::unique_ptr<SdrMark>& rItem) { return rItem->GetMarkedSdrObj() == nullptr; }),
+ maList.end());
+ nCount = maList.size();
+ }
- // remove invalid
- if(nCount > 0 )
- {
- maList.erase(std::remove_if(maList.begin(), maList.end(),
- [](std::unique_ptr<SdrMark>& rItem) { return rItem->GetMarkedSdrObj() == nullptr; }),
- maList.end());
- nCount = maList.size();
- }
+ if(nCount <= 1)
+ return;
- if(nCount > 1)
- {
- std::sort(maList.begin(), maList.end(), ImpSdrMarkListSorter);
+ std::sort(maList.begin(), maList.end(), ImpSdrMarkListSorter);
- // remove duplicates
- if(maList.size() > 1)
- {
- SdrMark* pCurrent = maList.back().get();
- for (size_t count = maList.size() - 1; count; --count)
- {
- size_t i = count - 1;
- SdrMark* pCmp = maList[i].get();
- assert(pCurrent->GetMarkedSdrObj());
- if(pCurrent->GetMarkedSdrObj() == pCmp->GetMarkedSdrObj())
- {
- // Con1/Con2 Merging
- if(pCmp->IsCon1())
- pCurrent->SetCon1(true);
+ // remove duplicates
+ if(maList.size() <= 1)
+ return;
- if(pCmp->IsCon2())
- pCurrent->SetCon2(true);
+ SdrMark* pCurrent = maList.back().get();
+ for (size_t count = maList.size() - 1; count; --count)
+ {
+ size_t i = count - 1;
+ SdrMark* pCmp = maList[i].get();
+ assert(pCurrent->GetMarkedSdrObj());
+ if(pCurrent->GetMarkedSdrObj() == pCmp->GetMarkedSdrObj())
+ {
+ // Con1/Con2 Merging
+ if(pCmp->IsCon1())
+ pCurrent->SetCon1(true);
- // delete pCmp
- maList.erase(maList.begin() + i);
- }
- else
- {
- pCurrent = pCmp;
- }
- }
- }
+ if(pCmp->IsCon2())
+ pCurrent->SetCon2(true);
+
+ // delete pCmp
+ maList.erase(maList.begin() + i);
+ }
+ else
+ {
+ pCurrent = pCmp;
}
}
}
@@ -694,96 +694,96 @@ namespace sdr
void ViewSelection::ImplCollectCompleteSelection(SdrObject* pObj)
{
- if(pObj)
+ if(!pObj)
+ return;
+
+ bool bIsGroup(pObj->IsGroupObject());
+
+ if(bIsGroup && dynamic_cast< const E3dObject* >(pObj) != nullptr && dynamic_cast< const E3dScene* >(pObj) == nullptr)
{
- bool bIsGroup(pObj->IsGroupObject());
+ bIsGroup = false;
+ }
- if(bIsGroup && dynamic_cast< const E3dObject* >(pObj) != nullptr && dynamic_cast< const E3dScene* >(pObj) == nullptr)
- {
- bIsGroup = false;
- }
+ if(bIsGroup)
+ {
+ SdrObjList* pList = pObj->GetSubList();
- if(bIsGroup)
+ for(size_t a = 0; a < pList->GetObjCount(); ++a)
{
- SdrObjList* pList = pObj->GetSubList();
-
- for(size_t a = 0; a < pList->GetObjCount(); ++a)
- {
- SdrObject* pObj2 = pList->GetObj(a);
- ImplCollectCompleteSelection(pObj2);
- }
+ SdrObject* pObj2 = pList->GetObj(a);
+ ImplCollectCompleteSelection(pObj2);
}
-
- maAllMarkedObjects.push_back(pObj);
}
+
+ maAllMarkedObjects.push_back(pObj);
}
void ViewSelection::ImpForceEdgesOfMarkedNodes()
{
- if(mbEdgesOfMarkedNodesDirty)
- {
- mbEdgesOfMarkedNodesDirty = false;
- maMarkedObjectList.ForceSort();
- maEdgesOfMarkedNodes.Clear();
- maMarkedEdgesOfMarkedNodes.Clear();
- maAllMarkedObjects.clear();
+ if(!mbEdgesOfMarkedNodesDirty)
+ return;
+
+ mbEdgesOfMarkedNodesDirty = false;
+ maMarkedObjectList.ForceSort();
+ maEdgesOfMarkedNodes.Clear();
+ maMarkedEdgesOfMarkedNodes.Clear();
+ maAllMarkedObjects.clear();
- // GetMarkCount after ForceSort
- const size_t nMarkCount(maMarkedObjectList.GetMarkCount());
+ // GetMarkCount after ForceSort
+ const size_t nMarkCount(maMarkedObjectList.GetMarkCount());
- for(size_t a = 0; a < nMarkCount; ++a)
+ for(size_t a = 0; a < nMarkCount; ++a)
+ {
+ SdrObject* pCandidate = maMarkedObjectList.GetMark(a)->GetMarkedSdrObj();
+
+ if(pCandidate)
{
- SdrObject* pCandidate = maMarkedObjectList.GetMark(a)->GetMarkedSdrObj();
+ // build transitive hull
+ ImplCollectCompleteSelection(pCandidate);
- if(pCandidate)
- {
- // build transitive hull
- ImplCollectCompleteSelection(pCandidate);
+ // travel over broadcaster/listener to access edges connected to the selected object
+ const SfxBroadcaster* pBC = pCandidate->GetBroadcaster();
- // travel over broadcaster/listener to access edges connected to the selected object
- const SfxBroadcaster* pBC = pCandidate->GetBroadcaster();
+ if(pBC)
+ {
+ const size_t nLstCnt(pBC->GetSizeOfVector());
- if(pBC)
+ for(size_t nl=0; nl < nLstCnt; ++nl)
{
- const size_t nLstCnt(pBC->GetSizeOfVector());
+ SfxListener* pLst = pBC->GetListener(nl);
+ SdrEdgeObj* pEdge = dynamic_cast<SdrEdgeObj*>( pLst );
- for(size_t nl=0; nl < nLstCnt; ++nl)
+ if(pEdge && pEdge->IsInserted() && pEdge->getSdrPageFromSdrObject() == pCandidate->getSdrPageFromSdrObject())
{
- SfxListener* pLst = pBC->GetListener(nl);
- SdrEdgeObj* pEdge = dynamic_cast<SdrEdgeObj*>( pLst );
+ SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());
- if(pEdge && pEdge->IsInserted() && pEdge->getSdrPageFromSdrObject() == pCandidate->getSdrPageFromSdrObject())
+ if(pEdge->GetConnectedNode(true) == pCandidate)
{
- SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());
-
- if(pEdge->GetConnectedNode(true) == pCandidate)
- {
- aM.SetCon1(true);
- }
-
- if(pEdge->GetConnectedNode(false) == pCandidate)
- {
- aM.SetCon2(true);
- }
-
- if(SAL_MAX_SIZE == maMarkedObjectList.FindObject(pEdge))
- {
- // check if it itself is selected
- maEdgesOfMarkedNodes.InsertEntry(aM);
- }
- else
- {
- maMarkedEdgesOfMarkedNodes.InsertEntry(aM);
- }
+ aM.SetCon1(true);
+ }
+
+ if(pEdge->GetConnectedNode(false) == pCandidate)
+ {
+ aM.SetCon2(true);
+ }
+
+ if(SAL_MAX_SIZE == maMarkedObjectList.FindObject(pEdge))
+ {
+ // check if it itself is selected
+ maEdgesOfMarkedNodes.InsertEntry(aM);
+ }
+ else
+ {
+ maMarkedEdgesOfMarkedNodes.InsertEntry(aM);
}
}
}
}
}
-
- maEdgesOfMarkedNodes.ForceSort();
- maMarkedEdgesOfMarkedNodes.ForceSort();
}
+
+ maEdgesOfMarkedNodes.ForceSort();
+ maMarkedEdgesOfMarkedNodes.ForceSort();
}
} // end of namespace sdr
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index ccab4da45a4a..c3afe2ccb352 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -388,24 +388,24 @@ void SdrModel::Repeat(SfxRepeatTarget& rView)
void SdrModel::ImpPostUndoAction(std::unique_ptr<SdrUndoAction> pUndo)
{
DBG_ASSERT( mpImpl->mpUndoManager == nullptr, "svx::SdrModel::ImpPostUndoAction(), method not supported with application undo manager!" );
- if( IsUndoEnabled() )
+ if( !IsUndoEnabled() )
+ return;
+
+ if (m_aUndoLink)
{
- if (m_aUndoLink)
- {
- m_aUndoLink(std::move(pUndo));
- }
- else
+ m_aUndoLink(std::move(pUndo));
+ }
+ else
+ {
+ if (!m_pUndoStack)
+ m_pUndoStack.reset(new std::deque<std::unique_ptr<SfxUndoAction>>);
+ m_pUndoStack->emplace_front(std::move(pUndo));
+ while (m_pUndoStack->size()>m_nMaxUndoCount)
{
- if (!m_pUndoStack)
- m_pUndoStack.reset(new std::deque<std::unique_ptr<SfxUndoAction>>);
- m_pUndoStack->emplace_front(std::move(pUndo));
- while (m_pUndoStack->size()>m_nMaxUndoCount)
- {
- m_pUndoStack->pop_back();
- }
- if (m_pRedoStack!=nullptr)
- m_pRedoStack->clear();
+ m_pUndoStack->pop_back();
}
+ if (m_pRedoStack!=nullptr)
+ m_pRedoStack->clear();
}
}
@@ -1730,55 +1730,55 @@ void SdrModel::setLock( bool bLock )
void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSet, SdrModel* pNewModelel )
{
assert(pNewModelel != nullptr);
- if( pSourceSet && pDestSet && (pSourceSet != pDestSet ) )
- {
- SfxWhichIter aWhichIter(*pSourceSet);
- sal_uInt16 nWhich(aWhichIter.FirstWhich());
- const SfxPoolItem *pPoolItem;
+ if( !(pSourceSet && pDestSet && (pSourceSet != pDestSet )) )
+ return;
+
+ SfxWhichIter aWhichIter(*pSourceSet);
+ sal_uInt16 nWhich(aWhichIter.FirstWhich());
+ const SfxPoolItem *pPoolItem;
- while(nWhich)
+ while(nWhich)
+ {
+ if(SfxItemState::SET == pSourceSet->GetItemState(nWhich, false, &pPoolItem))
{
- if(SfxItemState::SET == pSourceSet->GetItemState(nWhich, false, &pPoolItem))
- {
- std::unique_ptr<SfxPoolItem> pResultItem;
+ std::unique_ptr<SfxPoolItem> pResultItem;
- switch( nWhich )
- {
- case XATTR_FILLBITMAP:
- pResultItem = static_cast<const XFillBitmapItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINEDASH:
- pResultItem = static_cast<const XLineDashItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINESTART:
- pResultItem = static_cast<const XLineStartItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_LINEEND:
- pResultItem = static_cast<const XLineEndItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLGRADIENT:
- pResultItem = static_cast<const XFillGradientItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLFLOATTRANSPARENCE:
- // allow all kinds of XFillFloatTransparenceItem to be set
- pResultItem = static_cast<const XFillFloatTransparenceItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- case XATTR_FILLHATCH:
- pResultItem = static_cast<const XFillHatchItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
- break;
- }
+ switch( nWhich )
+ {
+ case XATTR_FILLBITMAP:
+ pResultItem = static_cast<const XFillBitmapItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINEDASH:
+ pResultItem = static_cast<const XLineDashItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINESTART:
+ pResultItem = static_cast<const XLineStartItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_LINEEND:
+ pResultItem = static_cast<const XLineEndItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLGRADIENT:
+ pResultItem = static_cast<const XFillGradientItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLFLOATTRANSPARENCE:
+ // allow all kinds of XFillFloatTransparenceItem to be set
+ pResultItem = static_cast<const XFillFloatTransparenceItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ case XATTR_FILLHATCH:
+ pResultItem = static_cast<const XFillHatchItem*>(pPoolItem)->checkForUniqueItem( pNewModelel );
+ break;
+ }
- // set item
- if( pResultItem )
- {
- pDestSet->Put(*pResultItem);
- pResultItem.reset();
- }
- else
- pDestSet->Put(*pPoolItem);
+ // set item
+ if( pResultItem )
+ {
+ pDestSet->Put(*pResultItem);
+ pResultItem.reset();
}
- nWhich = aWhichIter.NextWhich();
+ else
+ pDestSet->Put(*pPoolItem);
}
+ nWhich = aWhichIter.NextWhich();
}
}
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index b1472651875c..2c85e8be56c0 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -236,47 +236,47 @@ void SdrMarkView::ModelHasChanged()
AdjustMarkHdl();
}
- if (comphelper::LibreOfficeKit::isActive() && GetMarkedObjectCount() > 0)
+ if (!(comphelper::LibreOfficeKit::isActive() && GetMarkedObjectCount() > 0))
+ return;
+
+ //TODO: Is MarkedObjRect valid at this point?
+ tools::Rectangle aSelection(GetMarkedObjRect());
+ OString sSelection;
+ if (aSelection.IsEmpty())
+ sSelection = "EMPTY";
+ else
{
- //TODO: Is MarkedObjRect valid at this point?
- tools::Rectangle aSelection(GetMarkedObjRect());
- OString sSelection;
- if (aSelection.IsEmpty())
- sSelection = "EMPTY";
- else
+ 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());
}
}
+ }
- // 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();
}
- if(SfxViewShell* pViewShell = GetSfxViewShell())
- SfxLokHelper::notifyInvalidation(pViewShell, sSelection);
+ sSelection = aSelection.toString();
}
+