2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2006-09-17 04:31:43 +00:00
|
|
|
|
2009-11-25 16:50:10 +00:00
|
|
|
#include <com/sun/star/i18n/WordType.hpp>
|
|
|
|
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <svl/intitem.hxx>
|
2013-05-29 08:10:49 +00:00
|
|
|
#include <svl/itempool.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/editeng.hxx>
|
|
|
|
#include <editeng/editview.hxx>
|
|
|
|
#include <editeng/editdata.hxx>
|
|
|
|
#include <editeng/eerdll.hxx>
|
|
|
|
#include <editeng/lrspitem.hxx>
|
|
|
|
#include <editeng/fhgtitem.hxx>
|
2010-02-26 08:13:29 +01:00
|
|
|
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/style.hxx>
|
2014-02-10 01:26:35 -05:00
|
|
|
#include <svl/languageoptions.hxx>
|
2013-04-05 18:40:39 +02:00
|
|
|
#include <i18nlangtag/languagetag.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/outliner.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <outleeng.hxx>
|
|
|
|
#include <paralist.hxx>
|
|
|
|
#include <outlundo.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/outlobj.hxx>
|
|
|
|
#include <editeng/flditem.hxx>
|
|
|
|
#include <editeng/eeitem.hxx>
|
|
|
|
#include <editeng/numitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/window.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itemset.hxx>
|
2013-04-10 08:20:16 +00:00
|
|
|
#include <svl/eitem.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/editstat.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-11-25 16:50:10 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
OutlinerView::OutlinerView( Outliner* pOut, vcl::Window* pWin )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pOwner = pOut;
|
|
|
|
|
|
|
|
pEditView = new EditView( pOut->pEditEngine, pWin );
|
|
|
|
pEditView->SetSelectionMode( EE_SELMODE_TXTONLY );
|
|
|
|
}
|
|
|
|
|
|
|
|
OutlinerView::~OutlinerView()
|
|
|
|
{
|
|
|
|
delete pEditView;
|
|
|
|
}
|
|
|
|
|
2012-05-03 10:59:32 +00:00
|
|
|
void OutlinerView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-06-06 00:04:47 +02:00
|
|
|
// For the first Paint/KeyInput/Drop an empty Outliner is turned into
|
2011-02-16 16:34:02 -05:00
|
|
|
// an Outliner with exactly one paragraph.
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pOwner->bFirstParaIsEmpty )
|
2013-09-10 11:37:13 +02:00
|
|
|
pOwner->Insert( OUString() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-05-03 10:59:32 +00:00
|
|
|
pEditView->Paint( rRect, pTargetDevice );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt, vcl::Window* pFrameWin )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-06-06 00:04:47 +02:00
|
|
|
// For the first Paint/KeyInput/Drop an empty Outliner is turned into
|
2011-02-16 16:34:02 -05:00
|
|
|
// an Outliner with exactly one paragraph.
|
2000-09-18 16:07:07 +00:00
|
|
|
if( pOwner->bFirstParaIsEmpty )
|
2013-09-10 11:37:13 +02:00
|
|
|
pOwner->Insert( OUString() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bKeyProcessed = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
ESelection aSel( pEditView->GetSelection() );
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bSelection = aSel.HasRange();
|
2014-08-23 22:22:32 +03:00
|
|
|
vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
|
2000-09-18 16:07:07 +00:00
|
|
|
KeyFuncType eFunc = aKeyCode.GetFunction();
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 nCode = aKeyCode.GetCode();
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bReadOnly = IsReadOnly();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-10-31 14:43:41 +00:00
|
|
|
if( bSelection && ( nCode != KEY_TAB ) && EditEngine::DoesKeyChangeText( rKEvt ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
if ( ImpCalcSelectedPages( false ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
|
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-10-26 13:01:46 +02:00
|
|
|
if ( eFunc != KeyFuncType::DONTKNOW )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
switch ( eFunc )
|
|
|
|
{
|
2014-10-26 13:01:46 +02:00
|
|
|
case KeyFuncType::CUT:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !bReadOnly )
|
|
|
|
{
|
|
|
|
Cut();
|
2014-02-25 14:19:24 +02:00
|
|
|
bKeyProcessed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2014-10-26 13:01:46 +02:00
|
|
|
case KeyFuncType::COPY:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Copy();
|
2014-02-25 14:19:24 +02:00
|
|
|
bKeyProcessed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
2014-10-26 13:01:46 +02:00
|
|
|
case KeyFuncType::PASTE:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !bReadOnly )
|
|
|
|
{
|
|
|
|
PasteSpecial();
|
2014-02-25 14:19:24 +02:00
|
|
|
bKeyProcessed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2014-10-26 13:01:46 +02:00
|
|
|
case KeyFuncType::DELETE:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( !bReadOnly && !bSelection && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) )
|
|
|
|
{
|
|
|
|
if( aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
|
|
|
|
{
|
|
|
|
Paragraph* pNext = pOwner->pParaList->GetParagraph( aSel.nEndPara+1 );
|
2015-02-27 11:49:51 +02:00
|
|
|
if( pNext && pNext->HasFlag(ParaFlag::ISPAGE) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( !pOwner->ImpCanDeleteSelectedPages( this, aSel.nEndPara, 1 ) )
|
2014-02-25 14:19:24 +02:00
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2011-02-16 16:34:02 -05:00
|
|
|
default: // is then possibly edited below.
|
2014-10-26 13:01:46 +02:00
|
|
|
eFunc = KeyFuncType::DONTKNOW;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2014-10-26 13:01:46 +02:00
|
|
|
if ( eFunc == KeyFuncType::DONTKNOW )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
switch ( nCode )
|
|
|
|
{
|
|
|
|
case KEY_TAB:
|
|
|
|
{
|
|
|
|
if ( !bReadOnly && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() )
|
|
|
|
{
|
|
|
|
if ( ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) &&
|
|
|
|
( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TITLEOBJECT ) &&
|
|
|
|
( bSelection || !aSel.nStartPos ) )
|
|
|
|
{
|
2001-03-20 08:08:06 +00:00
|
|
|
Indent( aKeyCode.IsShift() ? (-1) : (+1) );
|
2014-02-25 14:19:24 +02:00
|
|
|
bKeyProcessed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) &&
|
2013-05-29 08:10:49 +00:00
|
|
|
!bSelection && !aSel.nEndPos && pOwner->ImplHasNumberFormat( aSel.nEndPara ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-03-20 08:08:06 +00:00
|
|
|
Indent( aKeyCode.IsShift() ? (-1) : (+1) );
|
2014-02-25 14:19:24 +02:00
|
|
|
bKeyProcessed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case KEY_BACKSPACE:
|
|
|
|
{
|
|
|
|
if( !bReadOnly && !bSelection && aSel.nEndPara && !aSel.nEndPos )
|
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara );
|
|
|
|
Paragraph* pPrev = pOwner->pParaList->GetParagraph( aSel.nEndPara-1 );
|
|
|
|
if( !pPrev->IsVisible() )
|
2014-02-25 14:19:24 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !pPara->GetDepth() )
|
|
|
|
{
|
|
|
|
if(!pOwner->ImpCanDeleteSelectedPages(this, aSel.nEndPara , 1 ) )
|
2014-02-25 14:19:24 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case KEY_RETURN:
|
|
|
|
{
|
|
|
|
if ( !bReadOnly )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Special treatment: hard return at the end of a paragraph,
|
|
|
|
// which has collapsed subparagraphs.
|
2000-09-18 16:07:07 +00:00
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara );
|
|
|
|
|
|
|
|
if( !aKeyCode.IsShift() )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// ImpGetCursor again???
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !bSelection &&
|
|
|
|
aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
|
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nChildren = pOwner->pParaList->GetChildCount(pPara);
|
2011-12-07 02:33:51 -08:00
|
|
|
if( nChildren && !pOwner->pParaList->HasVisibleChildren(pPara))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pOwner->UndoActionStart( OLUNDO_INSERT );
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nTemp = aSel.nEndPara;
|
2011-12-07 02:33:51 -08:00
|
|
|
nTemp += nChildren;
|
2011-02-16 16:34:02 -05:00
|
|
|
nTemp++; // insert above next Non-Child
|
2013-05-08 18:12:32 +02:00
|
|
|
SAL_WARN_IF( nTemp < 0, "editeng", "OutlinerView::PostKeyEvent - overflow");
|
|
|
|
if (nTemp >= 0)
|
|
|
|
{
|
2013-09-10 11:37:13 +02:00
|
|
|
pOwner->Insert( OUString(),nTemp,pPara->GetDepth());
|
2013-05-08 18:12:32 +02:00
|
|
|
// Position the cursor
|
|
|
|
ESelection aTmpSel(nTemp,0,nTemp,0);
|
|
|
|
pEditView->SetSelection( aTmpSel );
|
|
|
|
}
|
2014-02-20 11:55:27 +02:00
|
|
|
pEditView->ShowCursor( true, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
pOwner->UndoActionEnd( OLUNDO_INSERT );
|
2014-02-25 14:19:24 +02:00
|
|
|
bKeyProcessed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( !bKeyProcessed && !bSelection &&
|
|
|
|
!aKeyCode.IsShift() && aKeyCode.IsMod1() &&
|
|
|
|
( aSel.nEndPos == pOwner->pEditEngine->GetTextLen(aSel.nEndPara) ) )
|
|
|
|
{
|
|
|
|
pOwner->UndoActionStart( OLUNDO_INSERT );
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nTemp = aSel.nEndPara;
|
2000-09-18 16:07:07 +00:00
|
|
|
nTemp++;
|
2013-09-10 11:37:13 +02:00
|
|
|
pOwner->Insert( OUString(), nTemp, pPara->GetDepth()+1 );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Position the cursor
|
2013-05-08 18:12:32 +02:00
|
|
|
ESelection aTmpSel(nTemp,0,nTemp,0);
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->SetSelection( aTmpSel );
|
2014-02-20 11:55:27 +02:00
|
|
|
pEditView->ShowCursor( true, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
pOwner->UndoActionEnd( OLUNDO_INSERT );
|
2014-02-25 14:19:24 +02:00
|
|
|
bKeyProcessed = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-06 07:44:11 +02:00
|
|
|
return bKeyProcessed || pEditView->PostKeyEvent( rKEvt, pFrameWin );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nPara = EE_PARA_NOT_FOUND;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-07-24 12:18:20 +00:00
|
|
|
Point aMousePosWin = pEditView->GetWindow()->PixelToLogic( rPosPix );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
|
2002-07-24 12:18:20 +00:00
|
|
|
{
|
2015-03-24 14:38:03 +02:00
|
|
|
reTarget = MouseTarget::Outside;
|
2002-07-24 12:18:20 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2015-03-24 14:38:03 +02:00
|
|
|
reTarget = MouseTarget::Text;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-07-24 12:18:20 +00:00
|
|
|
Point aPaperPos( aMousePosWin );
|
2000-09-18 16:07:07 +00:00
|
|
|
Rectangle aOutArea = pEditView->GetOutputArea();
|
|
|
|
Rectangle aVisArea = pEditView->GetVisArea();
|
2002-07-24 12:18:20 +00:00
|
|
|
aPaperPos.X() -= aOutArea.Left();
|
|
|
|
aPaperPos.X() += aVisArea.Left();
|
|
|
|
aPaperPos.Y() -= aOutArea.Top();
|
|
|
|
aPaperPos.Y() += aVisArea.Top();
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bBullet;
|
2002-07-24 12:18:20 +00:00
|
|
|
if ( pOwner->IsTextPos( aPaperPos, 0, &bBullet ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-08-05 10:37:22 +00:00
|
|
|
Point aDocPos = pOwner->GetDocPos( aPaperPos );
|
|
|
|
nPara = pOwner->pEditEngine->FindParagraph( aDocPos.Y() );
|
|
|
|
|
2002-07-24 12:18:20 +00:00
|
|
|
if ( bBullet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-03-24 14:38:03 +02:00
|
|
|
reTarget = MouseTarget::Bullet;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2002-07-24 12:18:20 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Check for hyperlink
|
|
|
|
const SvxFieldItem* pFieldItem = pEditView->GetField( aMousePosWin );
|
|
|
|
if ( pFieldItem && pFieldItem->GetField() && pFieldItem->GetField()->ISA( SvxURLField ) )
|
2015-03-24 14:38:03 +02:00
|
|
|
reTarget = MouseTarget::Hypertext;
|
2002-07-24 12:18:20 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nPara;
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool OutlinerView::MouseMove( const MouseEvent& rMEvt )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode())
|
|
|
|
return pEditView->MouseMove( rMEvt );
|
|
|
|
|
2002-07-24 12:18:20 +00:00
|
|
|
Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
|
|
|
|
if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
|
2014-02-25 14:19:24 +02:00
|
|
|
return false;
|
2002-07-24 12:18:20 +00:00
|
|
|
|
|
|
|
Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
|
|
|
|
pEditView->GetWindow()->SetPointer( aPointer );
|
|
|
|
return pEditView->MouseMove( rMEvt );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() )
|
|
|
|
return pEditView->MouseButtonDown( rMEvt );
|
|
|
|
|
2002-07-24 12:18:20 +00:00
|
|
|
Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
|
|
|
|
if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
|
2014-02-25 14:19:24 +02:00
|
|
|
return false;
|
2001-08-24 12:52:13 +00:00
|
|
|
|
2002-07-24 12:18:20 +00:00
|
|
|
Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
|
|
|
|
pEditView->GetWindow()->SetPointer( aPointer );
|
|
|
|
|
|
|
|
MouseTarget eTarget;
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nPara = ImpCheckMousePos( rMEvt.GetPosPixel(), eTarget );
|
2015-03-24 14:38:03 +02:00
|
|
|
if ( eTarget == MouseTarget::Bullet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bHasChildren = (pPara && pOwner->pParaList->HasChildren(pPara));
|
2000-09-18 16:07:07 +00:00
|
|
|
if( rMEvt.GetClicks() == 1 )
|
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nEndPara = nPara;
|
2011-12-07 02:33:51 -08:00
|
|
|
if ( bHasChildren && pOwner->pParaList->HasVisibleChildren(pPara) )
|
2000-09-18 16:07:07 +00:00
|
|
|
nEndPara += pOwner->pParaList->GetChildCount( pPara );
|
2011-02-16 16:34:02 -05:00
|
|
|
// The selection is inverted, so that EditEngine does not scroll
|
2013-05-08 18:12:32 +02:00
|
|
|
ESelection aSel(nEndPara, EE_TEXTPOS_ALL, nPara, 0 );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->SetSelection( aSel );
|
|
|
|
}
|
2011-12-07 02:33:51 -08:00
|
|
|
else if( rMEvt.GetClicks() == 2 && bHasChildren )
|
2000-09-18 16:07:07 +00:00
|
|
|
ImpToggleExpand( pPara );
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
return true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2009-11-16 17:58:26 +01:00
|
|
|
|
|
|
|
// special case for outliner view in impress, check if double click hits the page icon for toggle
|
2015-03-24 14:38:03 +02:00
|
|
|
if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEVIEW) && (eTarget == MouseTarget::Text) && (rMEvt.GetClicks() == 2) )
|
2009-11-16 17:58:26 +01:00
|
|
|
{
|
|
|
|
ESelection aSel( pEditView->GetSelection() );
|
|
|
|
nPara = aSel.nStartPara;
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2015-02-27 11:49:51 +02:00
|
|
|
if( (pPara && pOwner->pParaList->HasChildren(pPara)) && pPara->HasFlag(ParaFlag::ISPAGE) )
|
2009-11-16 17:58:26 +01:00
|
|
|
{
|
|
|
|
ImpToggleExpand( pPara );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
return pEditView->MouseButtonDown( rMEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool OutlinerView::MouseButtonUp( const MouseEvent& rMEvt )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() )
|
|
|
|
return pEditView->MouseButtonUp( rMEvt );
|
|
|
|
|
2002-07-24 12:18:20 +00:00
|
|
|
Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
|
|
|
|
if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
|
2014-02-25 14:19:24 +02:00
|
|
|
return false;
|
2002-07-24 12:18:20 +00:00
|
|
|
|
|
|
|
Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
|
|
|
|
pEditView->GetWindow()->SetPointer( aPointer );
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return pEditView->MouseButtonUp( rMEvt );
|
|
|
|
}
|
|
|
|
|
2014-10-07 16:52:11 +01:00
|
|
|
void OutlinerView::ReleaseMouse()
|
|
|
|
{
|
|
|
|
pEditView->ReleaseMouse();
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void OutlinerView::ImpToggleExpand( Paragraph* pPara )
|
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nPara = pOwner->pParaList->GetAbsPos( pPara );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->SetSelection( ESelection( nPara, 0, nPara, 0 ) );
|
2011-12-07 02:33:51 -08:00
|
|
|
ImplExpandOrCollaps( nPara, nPara, !pOwner->pParaList->HasVisibleChildren( pPara ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->ShowCursor();
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
sal_Int32 OutlinerView::Select( Paragraph* pParagraph, bool bSelect,
|
|
|
|
bool bWithChildren )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nPara = pOwner->pParaList->GetAbsPos( pParagraph );
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nEnd = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bSelect )
|
2014-02-02 22:16:48 -06:00
|
|
|
nEnd = SAL_MAX_INT32;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nChildCount = 0;
|
2011-12-07 02:33:51 -08:00
|
|
|
if ( bWithChildren )
|
2000-09-18 16:07:07 +00:00
|
|
|
nChildCount = pOwner->pParaList->GetChildCount( pParagraph );
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
ESelection aSel( nPara, 0, nPara + nChildCount, nEnd );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->SetSelection( aSel );
|
|
|
|
return nChildCount+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::SetAttribs( const SfxItemSet& rAttrs )
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
|
2014-02-20 14:17:27 +02:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
|
|
|
|
pOwner->UndoActionStart( OLUNDO_ATTR );
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
ParaRange aSel = ImpGetSelectedParagraphs( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-06-06 11:32:40 +00:00
|
|
|
pEditView->SetAttribs( rAttrs );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Update Bullet text
|
2013-05-08 18:12:32 +02:00
|
|
|
for( sal_Int32 nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pOwner->ImplCheckNumBulletItem( nPara );
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->ImplCalcBulletText( nPara, false, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
|
|
|
|
pOwner->InsertUndo( new OutlinerUndoCheckPara( pOwner, nPara ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
|
|
|
|
pOwner->UndoActionEnd( OLUNDO_ATTR );
|
|
|
|
|
|
|
|
pEditView->SetEditEngineUpdateMode( bUpdate );
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
ParaRange OutlinerView::ImpGetSelectedParagraphs( bool bIncludeHiddenChildren )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ESelection aSel = pEditView->GetSelection();
|
|
|
|
ParaRange aParas( aSel.nStartPara, aSel.nEndPara );
|
|
|
|
aParas.Adjust();
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Record the invisible Children of the last Parents in the selection
|
2011-12-07 02:33:51 -08:00
|
|
|
if ( bIncludeHiddenChildren )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pLast = pOwner->pParaList->GetParagraph( aParas.nEndPara );
|
2011-12-07 02:33:51 -08:00
|
|
|
if ( pOwner->pParaList->HasHiddenChildren( pLast ) )
|
2013-05-08 18:12:32 +02:00
|
|
|
aParas.nEndPara = aParas.nEndPara + pOwner->pParaList->GetChildCount( pLast );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return aParas;
|
|
|
|
}
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// TODO: Name should be changed!
|
2000-09-18 16:07:07 +00:00
|
|
|
void OutlinerView::AdjustDepth( short nDX )
|
|
|
|
{
|
|
|
|
Indent( nDX );
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::Indent( short nDiff )
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( true ) && !pOwner->ImpCanIndentSelectedPages( this ) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
2015-03-24 16:05:55 +02:00
|
|
|
const bool bOutlinerView = bool(pOwner->pEditEngine->GetControlWord() & EEControlBits::OUTLINER);
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
|
2014-02-20 14:17:27 +02:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( bUndo )
|
|
|
|
pOwner->UndoActionStart( OLUNDO_DEPTH );
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
sal_Int16 nMinDepth = -1; // Optimization: Not to recalculate to manny parargaphs when not really needed.
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
ParaRange aSel = ImpGetSelectedParagraphs( true );
|
2013-05-08 18:12:32 +02:00
|
|
|
for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2008-06-06 11:32:40 +00:00
|
|
|
|
|
|
|
sal_Int16 nOldDepth = pPara->GetDepth();
|
|
|
|
sal_Int16 nNewDepth = nOldDepth + nDiff;
|
|
|
|
|
|
|
|
if( bOutlinerView && nPara )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-02-27 11:49:51 +02:00
|
|
|
const bool bPage = pPara->HasFlag(ParaFlag::ISPAGE);
|
2008-06-06 11:32:40 +00:00
|
|
|
if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0)) )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Notify App
|
2013-05-08 18:12:32 +02:00
|
|
|
pOwner->nDepthChangedHdlPrevDepth = nOldDepth;
|
2008-06-06 11:32:40 +00:00
|
|
|
pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
|
|
|
|
pOwner->pHdlParagraph = pPara;
|
|
|
|
|
|
|
|
if( bPage )
|
2015-02-27 11:49:51 +02:00
|
|
|
pPara->RemoveFlag( ParaFlag::ISPAGE );
|
2008-06-06 11:32:40 +00:00
|
|
|
else
|
2015-02-27 11:49:51 +02:00
|
|
|
pPara->SetFlag( ParaFlag::ISPAGE );
|
2008-06-06 11:32:40 +00:00
|
|
|
|
|
|
|
pOwner->DepthChangedHdl();
|
|
|
|
pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
|
|
|
|
|
|
|
|
if( bUndo )
|
|
|
|
pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nPara, pOwner->mnDepthChangeHdlPrevFlags, pPara->nFlags ) );
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2008-06-06 11:32:40 +00:00
|
|
|
// do not switch off numeration with tab
|
|
|
|
if( (nOldDepth == 0) && (nNewDepth == -1) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// do not indent if there is no numeration enabled
|
|
|
|
if( nOldDepth == -1 )
|
|
|
|
continue;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( nNewDepth < pOwner->nMinDepth )
|
|
|
|
nNewDepth = pOwner->nMinDepth;
|
|
|
|
if ( nNewDepth > pOwner->nMaxDepth )
|
|
|
|
nNewDepth = pOwner->nMaxDepth;
|
|
|
|
|
|
|
|
if( nOldDepth < nMinDepth )
|
|
|
|
nMinDepth = nOldDepth;
|
|
|
|
if( nNewDepth < nMinDepth )
|
|
|
|
nMinDepth = nNewDepth;
|
|
|
|
|
|
|
|
if( nOldDepth != nNewDepth )
|
|
|
|
{
|
2001-03-20 08:08:06 +00:00
|
|
|
if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ))
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Special case: the predecessor of an indented paragraph is
|
|
|
|
// invisible and is now on the same level as the visible
|
|
|
|
// paragraph. In this case, the next visible paragraph is
|
|
|
|
// searched for and fluffed.
|
2006-10-12 12:03:10 +00:00
|
|
|
#ifdef DBG_UTIL
|
|
|
|
Paragraph* _pPara = pOwner->pParaList->GetParagraph( aSel.nStartPara );
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT(_pPara->IsVisible(),"Selected Paragraph invisible ?!");
|
2006-10-12 12:03:10 +00:00
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
Paragraph* pPrev= pOwner->pParaList->GetParagraph( aSel.nStartPara-1 );
|
|
|
|
|
|
|
|
if( !pPrev->IsVisible() && ( pPrev->GetDepth() == nNewDepth ) )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Predecessor is collapsed and is on the same level
|
|
|
|
// => find next visible paragraph and expand it
|
2008-06-06 11:32:40 +00:00
|
|
|
pPrev = pOwner->pParaList->GetParent( pPrev );
|
2000-09-18 16:07:07 +00:00
|
|
|
while( !pPrev->IsVisible() )
|
2008-06-06 11:32:40 +00:00
|
|
|
pPrev = pOwner->pParaList->GetParent( pPrev );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pOwner->Expand( pPrev );
|
2014-06-13 13:55:14 +01:00
|
|
|
pOwner->InvalidateBullet(pOwner->pParaList->GetAbsPos(pPrev));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
pOwner->nDepthChangedHdlPrevDepth = nOldDepth;
|
2008-06-06 11:32:40 +00:00
|
|
|
pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
|
|
|
|
pOwner->pHdlParagraph = pPara;
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->ImplInitDepth( nPara, nNewDepth, true, false );
|
|
|
|
pOwner->ImplCalcBulletText( nPara, false, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
|
|
|
|
pOwner->ImplSetLevelDependendStyleSheet( nPara );
|
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// Notify App
|
2000-09-18 16:07:07 +00:00
|
|
|
pOwner->DepthChangedHdl();
|
|
|
|
}
|
2001-10-31 14:43:41 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Needs at least a repaint...
|
|
|
|
pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nParas = pOwner->pParaList->GetParagraphCount();
|
|
|
|
for ( sal_Int32 n = aSel.nEndPara+1; n < nParas; n++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( n );
|
|
|
|
if ( pPara->GetDepth() < nMinDepth )
|
|
|
|
break;
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->ImplCalcBulletText( n, false, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bUpdate )
|
|
|
|
{
|
2014-02-20 11:55:27 +02:00
|
|
|
pEditView->SetEditEngineUpdateMode( true );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->ShowCursor();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bUndo )
|
|
|
|
pOwner->UndoActionEnd( OLUNDO_DEPTH );
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool OutlinerView::AdjustHeight( long nDY )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2001-08-17 09:54:10 +00:00
|
|
|
pEditView->MoveParagraphs( nDY );
|
2014-02-25 14:19:24 +02:00
|
|
|
return true; // remove return value...
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle OutlinerView::GetVisArea() const
|
|
|
|
{
|
|
|
|
return pEditView->GetVisArea();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::Expand()
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
ParaRange aParas = ImpGetSelectedParagraphs( false );
|
|
|
|
ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::Collapse()
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
ParaRange aParas = ImpGetSelectedParagraphs( false );
|
|
|
|
ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::ExpandAll()
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
ImplExpandOrCollaps( 0, pOwner->pParaList->GetParagraphCount()-1, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::CollapseAll()
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
ImplExpandOrCollaps( 0, pOwner->pParaList->GetParagraphCount()-1, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
void OutlinerView::ImplExpandOrCollaps( sal_Int32 nStartPara, sal_Int32 nEndPara, bool bExpand )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bUpdate = pOwner->GetUpdateMode();
|
|
|
|
pOwner->SetUpdateMode( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bUndo )
|
|
|
|
pOwner->UndoActionStart( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE );
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bDone = bExpand ? pOwner->Expand( pPara ) : pOwner->Collapse( pPara );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( bDone )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// The line under the paragraph should disappear ...
|
2000-09-18 16:07:07 +00:00
|
|
|
pOwner->pEditEngine->QuickMarkToBeRepainted( nPara );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( bUndo )
|
|
|
|
pOwner->UndoActionEnd( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE );
|
|
|
|
|
|
|
|
if ( bUpdate )
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->SetUpdateMode( true );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->ShowCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::InsertText( const OutlinerParaObject& rParaObj )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Like Paste, only EditView::Insert, instead of EditView::Paste.
|
|
|
|
// Actually not quite true that possible indentations must be corrected,
|
|
|
|
// but that comes later by a universal import. The indentation level is
|
|
|
|
// then determined right in the Inserted method.
|
|
|
|
// Possible structure:
|
|
|
|
// pImportInfo with DestPara, DestPos, nFormat, pParaObj...
|
|
|
|
// Possibly problematic:
|
|
|
|
// EditEngine, RTF => Splitting the area, later join together.
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
if ( ImpCalcSelectedPages( false ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
pOwner->UndoActionStart( OLUNDO_INSERT );
|
|
|
|
|
2014-02-20 14:17:27 +02:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( false );
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nStart, nParaCount;
|
2000-09-18 16:07:07 +00:00
|
|
|
nParaCount = pOwner->pEditEngine->GetParagraphCount();
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 nSize = ImpInitPaste( nStart );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->InsertText( rParaObj.GetTextObject() );
|
|
|
|
ImpPasted( nStart, nParaCount, nSize);
|
2014-02-20 11:55:27 +02:00
|
|
|
pEditView->SetEditEngineUpdateMode( true );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
pOwner->UndoActionEnd( OLUNDO_INSERT );
|
|
|
|
|
2014-02-20 11:55:27 +02:00
|
|
|
pEditView->ShowCursor( true, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::Cut()
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
if ( !ImpCalcSelectedPages( false ) || pOwner->ImpCanDeleteSelectedPages( this ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->Cut();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::Paste()
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
PasteSpecial(); // HACK(SD does not call PasteSpecial)
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::PasteSpecial()
|
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
if ( !ImpCalcSelectedPages( false ) || pOwner->ImpCanDeleteSelectedPages( this ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pOwner->UndoActionStart( OLUNDO_INSERT );
|
|
|
|
|
2014-02-20 14:17:27 +02:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( false );
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->bPasting = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->PasteSpecial();
|
|
|
|
|
2009-10-14 15:14:05 +00:00
|
|
|
if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
|
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
const sal_Int32 nParaCount = pOwner->pEditEngine->GetParagraphCount();
|
2009-10-14 15:14:05 +00:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
for( sal_Int32 nPara = 0; nPara < nParaCount; nPara++ )
|
2009-10-14 15:14:05 +00:00
|
|
|
pOwner->ImplSetLevelDependendStyleSheet( nPara );
|
|
|
|
}
|
|
|
|
|
2014-02-20 11:55:27 +02:00
|
|
|
pEditView->SetEditEngineUpdateMode( true );
|
2000-09-18 16:07:07 +00:00
|
|
|
pOwner->UndoActionEnd( OLUNDO_INSERT );
|
2014-02-20 11:55:27 +02:00
|
|
|
pEditView->ShowCursor( true, true );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-09 12:57:55 -04:30
|
|
|
void OutlinerView::CreateSelectionList (std::vector<Paragraph*> &aSelList)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
ParaRange aParas = ImpGetSelectedParagraphs( true );
|
2011-03-09 12:57:55 -04:30
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
for ( sal_Int32 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2011-03-09 12:57:55 -04:30
|
|
|
aSelList.push_back(pPara);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-29 01:43:30 -04:00
|
|
|
const SfxStyleSheet* OutlinerView::GetStyleSheet() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->GetStyleSheet();
|
|
|
|
}
|
|
|
|
|
2012-03-29 09:53:19 +02:00
|
|
|
SfxStyleSheet* OutlinerView::GetStyleSheet()
|
|
|
|
{
|
|
|
|
return pEditView->GetStyleSheet();
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Pointer OutlinerView::GetPointer( const Point& rPosPixel )
|
|
|
|
{
|
|
|
|
MouseTarget eTarget;
|
|
|
|
ImpCheckMousePos( rPosPixel, eTarget );
|
2002-07-24 12:18:20 +00:00
|
|
|
|
2015-05-20 14:05:50 +02:00
|
|
|
PointerStyle ePointerStyle = PointerStyle::Arrow;
|
2015-03-24 14:38:03 +02:00
|
|
|
if ( eTarget == MouseTarget::Text )
|
2002-07-24 12:18:20 +00:00
|
|
|
{
|
2015-05-20 14:05:50 +02:00
|
|
|
ePointerStyle = GetOutliner()->IsVertical() ? PointerStyle::TextVertical : PointerStyle::Text;
|
2002-07-24 12:18:20 +00:00
|
|
|
}
|
2015-03-24 14:38:03 +02:00
|
|
|
else if ( eTarget == MouseTarget::Hypertext )
|
2002-07-24 12:18:20 +00:00
|
|
|
{
|
2015-05-20 14:05:50 +02:00
|
|
|
ePointerStyle = PointerStyle::RefHand;
|
2002-07-24 12:18:20 +00:00
|
|
|
}
|
2015-03-24 14:38:03 +02:00
|
|
|
else if ( eTarget == MouseTarget::Bullet )
|
2002-07-24 12:18:20 +00:00
|
|
|
{
|
2015-05-20 14:05:50 +02:00
|
|
|
ePointerStyle = PointerStyle::Move;
|
2002-07-24 12:18:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return Pointer( ePointerStyle );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 OutlinerView::ImpInitPaste( sal_Int32& rStart )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->bPasting = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
ESelection aSelection( pEditView->GetSelection() );
|
|
|
|
aSelection.Adjust();
|
|
|
|
rStart = aSelection.nStartPara;
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nSize = aSelection.nEndPara - aSelection.nStartPara + 1;
|
2000-09-18 16:07:07 +00:00
|
|
|
return nSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
void OutlinerView::ImpPasted( sal_Int32 nStart, sal_Int32 nPrevParaCount, sal_Int32 nSize)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->bPasting = false;
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nCurParaCount = pOwner->pEditEngine->GetParagraphCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
if( nCurParaCount < nPrevParaCount )
|
2013-05-08 18:12:32 +02:00
|
|
|
nSize = nSize - ( nPrevParaCount - nCurParaCount );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2013-05-08 18:12:32 +02:00
|
|
|
nSize = nSize + ( nCurParaCount - nPrevParaCount );
|
2000-09-18 16:07:07 +00:00
|
|
|
pOwner->ImpTextPasted( nStart, nSize );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::Command( const CommandEvent& rCEvt )
|
|
|
|
{
|
2001-08-17 09:54:10 +00:00
|
|
|
pEditView->Command( rCEvt );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
void OutlinerView::SelectRange( sal_Int32 nFirst, sal_Int32 nCount )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nLast = nFirst+nCount;
|
|
|
|
nCount = pOwner->pParaList->GetParagraphCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
if( nLast <= nCount )
|
|
|
|
nLast = nCount - 1;
|
2013-05-08 18:12:32 +02:00
|
|
|
ESelection aSel( nFirst, 0, nLast, EE_TEXTPOS_ALL );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->SetSelection( aSel );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
sal_Int32 OutlinerView::ImpCalcSelectedPages( bool bIncludeFirstSelected )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ESelection aSel( pEditView->GetSelection() );
|
|
|
|
aSel.Adjust();
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nPages = 0;
|
|
|
|
sal_Int32 nFirstPage = EE_PARA_MAX_COUNT;
|
|
|
|
sal_Int32 nStartPara = aSel.nStartPara;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !bIncludeFirstSelected )
|
2011-02-16 16:34:02 -05:00
|
|
|
nStartPara++; // All paragraphs after StartPara will be deleted
|
2013-05-08 18:12:32 +02:00
|
|
|
for ( sal_Int32 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2011-02-16 16:34:02 -05:00
|
|
|
DBG_ASSERT(pPara, "ImpCalcSelectedPages: invalid Selection? ");
|
2015-02-27 11:49:51 +02:00
|
|
|
if( pPara->HasFlag(ParaFlag::ISPAGE) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
nPages++;
|
2013-05-08 18:12:32 +02:00
|
|
|
if( nFirstPage == EE_PARA_MAX_COUNT )
|
2000-09-18 16:07:07 +00:00
|
|
|
nFirstPage = nPara;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nPages )
|
|
|
|
{
|
|
|
|
pOwner->nDepthChangedHdlPrevDepth = nPages;
|
2006-10-12 12:03:10 +00:00
|
|
|
pOwner->pHdlParagraph = 0;
|
|
|
|
pOwner->mnFirstSelPage = nFirstPage;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nPages;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-06 11:32:40 +00:00
|
|
|
void OutlinerView::ToggleBullets()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-06-06 11:32:40 +00:00
|
|
|
pOwner->UndoActionStart( OLUNDO_DEPTH );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ESelection aSel( pEditView->GetSelection() );
|
|
|
|
aSel.Adjust();
|
|
|
|
|
2008-06-06 11:32:40 +00:00
|
|
|
const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
|
2014-02-20 14:17:27 +02:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
sal_Int16 nNewDepth = -2;
|
|
|
|
const SvxNumRule* pDefaultBulletNumRule = 0;
|
2008-06-06 11:32:40 +00:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2008-06-06 11:32:40 +00:00
|
|
|
DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
|
|
|
|
|
|
|
|
if( pPara )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
if( nNewDepth == -2 )
|
|
|
|
{
|
|
|
|
nNewDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1;
|
|
|
|
if ( nNewDepth == 0 )
|
|
|
|
{
|
|
|
|
// determine default numbering rule for bullets
|
|
|
|
const ESelection aSelection(nPara, 0);
|
|
|
|
const SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
|
|
|
|
const SfxPoolItem& rPoolItem = aTmpSet.GetPool()->GetDefaultItem( EE_PARA_NUMBULLET );
|
|
|
|
const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(&rPoolItem);
|
|
|
|
pDefaultBulletNumRule = pNumBulletItem ? pNumBulletItem->GetNumRule() : 0;
|
|
|
|
}
|
|
|
|
}
|
2008-06-06 11:32:40 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
pOwner->SetDepth( pPara, nNewDepth );
|
2008-06-06 11:32:40 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
if( nNewDepth == -1 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-06-06 11:32:40 +00:00
|
|
|
const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
|
2014-09-10 17:53:41 +02:00
|
|
|
if ( rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SfxItemState::SET )
|
2008-06-06 11:32:40 +00:00
|
|
|
{
|
|
|
|
SfxItemSet aAttrs(rAttrs);
|
|
|
|
aAttrs.ClearItem( EE_PARA_BULLETSTATE );
|
|
|
|
pOwner->SetParaAttribs( nPara, aAttrs );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2013-05-29 08:10:49 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( pDefaultBulletNumRule )
|
|
|
|
{
|
|
|
|
const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat( nPara );
|
|
|
|
if ( !pFmt
|
|
|
|
|| ( pFmt->GetNumberingType() != SVX_NUM_BITMAP
|
|
|
|
&& pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL ) )
|
|
|
|
{
|
|
|
|
SfxItemSet aAttrs( pOwner->GetParaAttribs( nPara ) );
|
|
|
|
SvxNumRule aNewNumRule( *pDefaultBulletNumRule );
|
|
|
|
aAttrs.Put( SvxNumBulletItem( aNewNumRule ), EE_PARA_NUMBULLET );
|
|
|
|
pOwner->SetParaAttribs( nPara, aAttrs );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2008-06-06 11:32:40 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
const sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount();
|
2008-06-06 11:32:40 +00:00
|
|
|
pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
|
2013-03-09 19:27:15 +04:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
|
2013-03-09 19:27:15 +04:00
|
|
|
pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nEndPara, 0 ) );
|
2008-06-06 11:32:40 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( bUpdate );
|
|
|
|
|
2008-06-06 11:32:40 +00:00
|
|
|
pOwner->UndoActionEnd( OLUNDO_DEPTH );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
void OutlinerView::ToggleBulletsNumbering(
|
|
|
|
const bool bToggle,
|
|
|
|
const bool bHandleBullets,
|
|
|
|
const SvxNumRule* pNumRule )
|
|
|
|
{
|
2013-04-10 08:20:16 +00:00
|
|
|
ESelection aSel( pEditView->GetSelection() );
|
|
|
|
aSel.Adjust();
|
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
bool bToggleOn = true;
|
|
|
|
if ( bToggle )
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
bToggleOn = false;
|
|
|
|
const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.nStartPara, aSel.nEndPara ) );
|
|
|
|
if ( nBulletNumberingStatus != 0 && bHandleBullets )
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
// not all paragraphs have bullets and method called to toggle bullets --> bullets on
|
|
|
|
bToggleOn = true;
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
2013-05-29 08:10:49 +00:00
|
|
|
else if ( nBulletNumberingStatus != 1 && !bHandleBullets )
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
// not all paragraphs have numbering and method called to toggle numberings --> numberings on
|
|
|
|
bToggleOn = true;
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-29 08:10:49 +00:00
|
|
|
if ( bToggleOn )
|
|
|
|
{
|
|
|
|
// apply bullets/numbering for selected paragraphs
|
|
|
|
ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle, true );
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
2013-05-29 08:10:49 +00:00
|
|
|
else
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
// switch off bullets/numbering for selected paragraphs
|
|
|
|
SwitchOffBulletsNumbering( true );
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
return;
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
|
2008-11-20 14:55:36 +00:00
|
|
|
void OutlinerView::EnableBullets()
|
|
|
|
{
|
|
|
|
pOwner->UndoActionStart( OLUNDO_DEPTH );
|
|
|
|
|
|
|
|
ESelection aSel( pEditView->GetSelection() );
|
|
|
|
aSel.Adjust();
|
|
|
|
|
|
|
|
const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
|
2014-02-20 14:17:27 +02:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( false );
|
2008-11-20 14:55:36 +00:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
|
2008-11-20 14:55:36 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2013-05-29 08:10:49 +00:00
|
|
|
DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
|
2008-11-20 14:55:36 +00:00
|
|
|
|
|
|
|
if( pPara && (pOwner->GetDepth(nPara) == -1) )
|
|
|
|
{
|
|
|
|
pOwner->SetDepth( pPara, 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount();
|
2008-11-20 14:55:36 +00:00
|
|
|
pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
|
2013-03-09 19:27:15 +04:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
|
2013-03-09 19:27:15 +04:00
|
|
|
pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nEndPara, 0 ) );
|
2008-11-20 14:55:36 +00:00
|
|
|
|
|
|
|
pOwner->pEditEngine->SetUpdateMode( bUpdate );
|
|
|
|
|
|
|
|
pOwner->UndoActionEnd( OLUNDO_DEPTH );
|
|
|
|
}
|
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
|
|
|
|
void OutlinerView::ApplyBulletsNumbering(
|
|
|
|
const bool bHandleBullets,
|
|
|
|
const SvxNumRule* pNewNumRule,
|
|
|
|
const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
|
|
|
|
const bool bAtSelection )
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList)
|
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
return;
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pOwner->UndoActionStart(OLUNDO_DEPTH);
|
2014-02-25 14:19:24 +02:00
|
|
|
const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
|
2014-02-20 14:17:27 +02:00
|
|
|
pOwner->pEditEngine->SetUpdateMode(false);
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
sal_Int32 nStartPara = 0;
|
|
|
|
sal_Int32 nEndPara = 0;
|
|
|
|
if ( bAtSelection )
|
|
|
|
{
|
|
|
|
ESelection aSel( pEditView->GetSelection() );
|
|
|
|
aSel.Adjust();
|
|
|
|
nStartPara = aSel.nStartPara;
|
|
|
|
nEndPara = aSel.nEndPara;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nStartPara = 0;
|
|
|
|
nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara)
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
|
2013-05-29 08:10:49 +00:00
|
|
|
DBG_ASSERT(pPara, "OutlinerView::ApplyBulletsNumbering(..), illegal selection?");
|
2013-04-10 08:20:16 +00:00
|
|
|
|
|
|
|
if (pPara)
|
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
const sal_Int16 nDepth = pOwner->GetDepth(nPara);
|
|
|
|
if ( nDepth == -1 )
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
pOwner->SetDepth( pPara, 0 );
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara);
|
|
|
|
SfxItemSet aAttrs(rAttrs);
|
2013-05-29 08:10:49 +00:00
|
|
|
aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, true));
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
// apply new numbering rule
|
|
|
|
if ( pNewNumRule )
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
bool bApplyNumRule = false;
|
|
|
|
if ( !bCheckCurrentNumRuleBeforeApplyingNewNumRule )
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
bApplyNumRule = true;
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
|
|
|
|
if (!pFmt)
|
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
bApplyNumRule = true;
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sal_Int16 nNumType = pFmt->GetNumberingType();
|
2013-05-29 08:10:49 +00:00
|
|
|
if ( bHandleBullets
|
|
|
|
&& nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL)
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
// Set to Normal bullet, old bullet type is Numbering bullet.
|
2013-05-29 08:10:49 +00:00
|
|
|
bApplyNumRule = true;
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
2013-05-29 08:10:49 +00:00
|
|
|
else if ( !bHandleBullets
|
|
|
|
&& (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
// Set to Numbering bullet, old bullet type is Normal bullet.
|
2013-05-29 08:10:49 +00:00
|
|
|
bApplyNumRule = true;
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
if ( bApplyNumRule )
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
SvxNumRule aNewRule(*pNewNumRule);
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
// Get old bullet space.
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
const SfxPoolItem* pPoolItem=NULL;
|
2014-02-19 21:49:02 +01:00
|
|
|
SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, false, &pPoolItem);
|
2014-09-10 17:53:41 +02:00
|
|
|
if (eState != SfxItemState::SET)
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-05-29 08:10:49 +00:00
|
|
|
// Use default value when has not contain bullet item.
|
|
|
|
ESelection aSelection(nPara, 0);
|
|
|
|
SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
|
|
|
|
pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET);
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem);
|
|
|
|
if (pNumBulletItem)
|
|
|
|
{
|
|
|
|
const sal_uInt16 nLevelCnt = std::min(pNumBulletItem->GetNumRule()->GetLevelCount(), aNewRule.GetLevelCount());
|
|
|
|
for ( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel )
|
|
|
|
{
|
|
|
|
const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel);
|
|
|
|
const SvxNumberFormat* pNewFmt = aNewRule.Get(nLevel);
|
|
|
|
if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace()))
|
|
|
|
{
|
|
|
|
SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt);
|
|
|
|
pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset());
|
|
|
|
pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace());
|
|
|
|
aNewRule.SetLevel(nLevel, pNewFmtClone);
|
|
|
|
delete pNewFmtClone;
|
|
|
|
}
|
|
|
|
}
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET);
|
2013-05-29 08:10:49 +00:00
|
|
|
}
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
|
|
|
pOwner->SetParaAttribs(nPara, aAttrs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
|
|
|
|
pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
|
|
|
|
pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
|
|
|
|
|
|
|
|
pOwner->pEditEngine->SetUpdateMode( bUpdate );
|
|
|
|
|
|
|
|
pOwner->UndoActionEnd( OLUNDO_DEPTH );
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::SwitchOffBulletsNumbering(
|
|
|
|
const bool bAtSelection )
|
|
|
|
{
|
|
|
|
sal_Int32 nStartPara = 0;
|
|
|
|
sal_Int32 nEndPara = 0;
|
|
|
|
if ( bAtSelection )
|
|
|
|
{
|
|
|
|
ESelection aSel( pEditView->GetSelection() );
|
|
|
|
aSel.Adjust();
|
|
|
|
nStartPara = aSel.nStartPara;
|
|
|
|
nEndPara = aSel.nEndPara;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nStartPara = 0;
|
|
|
|
nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
pOwner->UndoActionStart( OLUNDO_DEPTH );
|
|
|
|
const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
|
2014-02-20 14:17:27 +02:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( false );
|
2013-05-29 08:10:49 +00:00
|
|
|
|
|
|
|
for ( sal_Int32 nPara = nStartPara; nPara <= nEndPara; ++nPara )
|
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
|
|
|
DBG_ASSERT(pPara, "OutlinerView::SwitchOffBulletsNumbering(...), illegal paragraph index?");
|
|
|
|
|
|
|
|
if( pPara )
|
|
|
|
{
|
|
|
|
pOwner->SetDepth( pPara, -1 );
|
|
|
|
|
|
|
|
const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
|
2014-09-10 17:53:41 +02:00
|
|
|
if (rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SfxItemState::SET)
|
2013-05-29 08:10:49 +00:00
|
|
|
{
|
|
|
|
SfxItemSet aAttrs(rAttrs);
|
|
|
|
aAttrs.ClearItem( EE_PARA_BULLETSTATE );
|
|
|
|
pOwner->SetParaAttribs( nPara, aAttrs );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
|
|
|
|
pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
|
|
|
|
pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
pOwner->pEditEngine->SetUpdateMode( bUpdate );
|
|
|
|
pOwner->UndoActionEnd( OLUNDO_DEPTH );
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
2008-11-20 14:55:36 +00:00
|
|
|
|
2013-05-29 08:10:49 +00:00
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
void OutlinerView::RemoveAttribsKeepLanguages( bool bRemoveParaAttribs )
|
2007-11-23 15:44:03 +00:00
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
RemoveAttribs( bRemoveParaAttribs, 0, true /*keep language attribs*/ );
|
2007-11-23 15:44:03 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
void OutlinerView::RemoveAttribs( bool bRemoveParaAttribs, sal_uInt16 nWhich, bool bKeepLanguages )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-02-25 14:19:24 +02:00
|
|
|
bool bUpdate = pOwner->GetUpdateMode();
|
|
|
|
pOwner->SetUpdateMode( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
pOwner->UndoActionStart( OLUNDO_ATTR );
|
2007-11-23 15:44:03 +00:00
|
|
|
if (bKeepLanguages)
|
|
|
|
pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
|
|
|
|
else
|
|
|
|
pEditView->RemoveAttribs( bRemoveParaAttribs, nWhich );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bRemoveParaAttribs )
|
|
|
|
{
|
2011-02-16 16:34:02 -05:00
|
|
|
// Loop through all paragraphs and set indentation and level
|
2000-09-18 16:07:07 +00:00
|
|
|
ESelection aSel = pEditView->GetSelection();
|
|
|
|
aSel.Adjust();
|
2013-05-08 18:12:32 +02:00
|
|
|
for ( sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->ImplInitDepth( nPara, pPara->GetDepth(), false, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pOwner->UndoActionEnd( OLUNDO_ATTR );
|
|
|
|
pOwner->SetUpdateMode( bUpdate );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2011-02-16 16:34:02 -05:00
|
|
|
// ====================== Simple pass-through =======================
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
void OutlinerView::InsertText( const OUString& rNew, bool bSelect )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( pOwner->bFirstParaIsEmpty )
|
2013-08-13 20:41:52 +01:00
|
|
|
pOwner->Insert( OUString() );
|
2000-09-18 16:07:07 +00:00
|
|
|
pEditView->InsertText( rNew, bSelect );
|
|
|
|
}
|
|
|
|
|
2013-03-12 09:25:32 +02:00
|
|
|
void OutlinerView::SetVisArea( const Rectangle& rRect )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-03-12 09:25:32 +02:00
|
|
|
pEditView->SetVisArea( rRect );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::SetSelection( const ESelection& rSel )
|
|
|
|
{
|
|
|
|
pEditView->SetSelection( rSel );
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
void OutlinerView::SetReadOnly( bool bReadOnly )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pEditView->SetReadOnly( bReadOnly );
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool OutlinerView::IsReadOnly() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->IsReadOnly();
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool OutlinerView::HasSelection() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->HasSelection();
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
void OutlinerView::ShowCursor( bool bGotoCursor )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pEditView->ShowCursor( bGotoCursor );
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::HideCursor()
|
|
|
|
{
|
|
|
|
pEditView->HideCursor();
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
void OutlinerView::SetWindow( vcl::Window* pWin )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pEditView->SetWindow( pWin );
|
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* OutlinerView::GetWindow() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->GetWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::SetOutputArea( const Rectangle& rRect )
|
|
|
|
{
|
|
|
|
pEditView->SetOutputArea( rRect );
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle OutlinerView::GetOutputArea() const
|
|
|
|
{
|
|
|
|
return pEditView->GetOutputArea();
|
|
|
|
}
|
|
|
|
|
2013-08-13 20:41:52 +01:00
|
|
|
OUString OutlinerView::GetSelected() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->GetSelected();
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
EESpellState OutlinerView::StartSpeller( bool bMultiDoc )
|
2000-12-05 10:13:08 +00:00
|
|
|
{
|
|
|
|
return pEditView->StartSpeller( bMultiDoc );
|
|
|
|
}
|
|
|
|
|
|
|
|
EESpellState OutlinerView::StartThesaurus()
|
|
|
|
{
|
|
|
|
return pEditView->StartThesaurus();
|
|
|
|
}
|
|
|
|
|
2004-09-17 12:45:57 +00:00
|
|
|
void OutlinerView::StartTextConversion(
|
2014-09-16 10:09:58 +02:00
|
|
|
LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont,
|
2014-02-25 14:19:24 +02:00
|
|
|
sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc )
|
2004-04-27 14:50:21 +00:00
|
|
|
{
|
2008-12-11 07:05:03 +00:00
|
|
|
if (
|
|
|
|
(LANGUAGE_KOREAN == nSrcLang && LANGUAGE_KOREAN == nDestLang) ||
|
|
|
|
(LANGUAGE_CHINESE_SIMPLIFIED == nSrcLang && LANGUAGE_CHINESE_TRADITIONAL == nDestLang) ||
|
|
|
|
(LANGUAGE_CHINESE_TRADITIONAL == nSrcLang && LANGUAGE_CHINESE_SIMPLIFIED == nDestLang)
|
|
|
|
)
|
|
|
|
{
|
2004-09-17 12:45:57 +00:00
|
|
|
pEditView->StartTextConversion( nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc );
|
2008-12-11 07:05:03 +00:00
|
|
|
}
|
2004-04-27 14:50:21 +00:00
|
|
|
else
|
2008-06-30 14:45:11 +00:00
|
|
|
{
|
2011-03-01 19:07:44 +01:00
|
|
|
OSL_FAIL( "unexpected language" );
|
2008-06-30 14:45:11 +00:00
|
|
|
}
|
2004-04-27 14:50:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->StartSearchAndReplace( rSearchItem );
|
|
|
|
}
|
|
|
|
|
2001-02-23 13:02:48 +00:00
|
|
|
void OutlinerView::TransliterateText( sal_Int32 nTransliterationMode )
|
|
|
|
{
|
|
|
|
pEditView->TransliterateText( nTransliterationMode );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ESelection OutlinerView::GetSelection()
|
|
|
|
{
|
|
|
|
return pEditView->GetSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OutlinerView::Scroll( long nHorzScroll, long nVertScroll )
|
|
|
|
{
|
|
|
|
pEditView->Scroll( nHorzScroll, nVertScroll );
|
|
|
|
}
|
|
|
|
|
2015-03-24 16:23:31 +02:00
|
|
|
void OutlinerView::SetControlWord( EVControlBits nWord )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pEditView->SetControlWord( nWord );
|
|
|
|
}
|
|
|
|
|
2015-03-24 16:23:31 +02:00
|
|
|
EVControlBits OutlinerView::GetControlWord() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->GetControlWord();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::SetAnchorMode( EVAnchorMode eMode )
|
|
|
|
{
|
|
|
|
pEditView->SetAnchorMode( eMode );
|
|
|
|
}
|
|
|
|
|
|
|
|
EVAnchorMode OutlinerView::GetAnchorMode() const
|
|
|
|
{
|
|
|
|
return pEditView->GetAnchorMode();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::Copy()
|
|
|
|
{
|
|
|
|
pEditView->Copy();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::InsertField( const SvxFieldItem& rFld )
|
|
|
|
{
|
|
|
|
pEditView->InsertField( rFld );
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const
|
|
|
|
{
|
|
|
|
return pEditView->GetFieldUnderMousePointer();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SvxFieldItem* OutlinerView::GetFieldAtSelection() const
|
|
|
|
{
|
|
|
|
return pEditView->GetFieldAtSelection();
|
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pEditView->SetInvalidateMore( nPixel );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 OutlinerView::GetInvalidateMore() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->GetInvalidateMore();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool OutlinerView::IsCursorAtWrongSpelledWord( bool bMarkIfWrong )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->IsCursorAtWrongSpelledWord( bMarkIfWrong );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWrong )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pEditView->IsWrongSpelledWordAtPos( rPosPixel, bMarkIfWrong );
|
|
|
|
}
|
|
|
|
|
2015-04-30 10:20:00 +02:00
|
|
|
void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, Link<>* pStartDlg )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pEditView->ExecuteSpellPopup( rPosPixel, pStartDlg );
|
|
|
|
}
|
|
|
|
|
2014-02-25 14:19:24 +02:00
|
|
|
sal_uLong OutlinerView::Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat eFormat, bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
ESelection aOldSel = pEditView->GetSelection();
|
|
|
|
aOldSel.Adjust();
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uLong nRet = pEditView->Read( rInput, rBaseURL, eFormat, bSelect, pHTTPHeaderAttrs );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
long nParaDiff = pEditView->GetEditEngine()->GetParagraphCount() - nOldParaCount;
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 nChangesStart = aOldSel.nStartPara;
|
|
|
|
sal_Int32 nChangesEnd = nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
for ( sal_Int32 n = nChangesStart; n <= nChangesEnd; n++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( eFormat == EE_FORMAT_BIN )
|
|
|
|
{
|
|
|
|
const SfxItemSet& rAttrs = pOwner->GetParaAttribs( n );
|
2014-09-30 09:02:35 +02:00
|
|
|
const SfxInt16Item& rLevel = static_cast<const SfxInt16Item&>( rAttrs.Get( EE_PARA_OUTLLEVEL ) );
|
2012-10-28 09:45:59 +01:00
|
|
|
sal_uInt16 nDepth = rLevel.GetValue();
|
2014-02-25 14:19:24 +02:00
|
|
|
pOwner->ImplInitDepth( n, nDepth, false );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
|
|
|
|
pOwner->ImplSetLevelDependendStyleSheet( n );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( eFormat != EE_FORMAT_BIN )
|
|
|
|
{
|
|
|
|
pOwner->ImpFilterIndents( nChangesStart, nChangesEnd );
|
|
|
|
}
|
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OutlinerView::SetBackgroundColor( const Color& rColor )
|
|
|
|
{
|
|
|
|
pEditView->SetBackgroundColor( rColor );
|
|
|
|
}
|
|
|
|
|
2015-02-19 14:38:53 +01:00
|
|
|
void OutlinerView::setTiledRendering(bool bTiledRendering)
|
|
|
|
{
|
|
|
|
pEditView->setTiledRendering(bTiledRendering);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2015-03-12 13:08:49 +01:00
|
|
|
void OutlinerView::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData)
|
|
|
|
{
|
|
|
|
pEditView->registerLibreOfficeKitCallback(pCallback, pLibreOfficeKitData);
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Color OutlinerView::GetBackgroundColor()
|
|
|
|
{
|
|
|
|
return pEditView->GetBackgroundColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxItemSet OutlinerView::GetAttribs()
|
|
|
|
{
|
|
|
|
return pEditView->GetAttribs();
|
|
|
|
}
|
2000-11-24 10:30:28 +00:00
|
|
|
|
2015-04-15 09:36:39 +02:00
|
|
|
SvtScriptType OutlinerView::GetSelectedScriptType() const
|
2000-11-24 10:30:28 +00:00
|
|
|
{
|
|
|
|
return pEditView->GetSelectedScriptType();
|
|
|
|
}
|
2009-06-17 10:58:14 +00:00
|
|
|
|
2013-09-06 16:31:38 +02:00
|
|
|
OUString OutlinerView::GetSurroundingText() const
|
2010-01-06 12:22:41 +01:00
|
|
|
{
|
|
|
|
return pEditView->GetSurroundingText();
|
|
|
|
}
|
|
|
|
|
|
|
|
Selection OutlinerView::GetSurroundingTextSelection() const
|
|
|
|
{
|
|
|
|
return pEditView->GetSurroundingTextSelection();
|
|
|
|
}
|
2009-11-25 16:50:10 +00:00
|
|
|
|
|
|
|
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2009-11-25 16:50:10 +00:00
|
|
|
// ===== some code for thesaurus sub menu within context menu
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2009-11-25 16:50:10 +00:00
|
|
|
|
2014-02-10 01:26:35 -05:00
|
|
|
namespace {
|
|
|
|
|
2015-04-15 09:36:39 +02:00
|
|
|
bool isSingleScriptType( SvtScriptType nScriptType )
|
2014-02-10 01:26:35 -05:00
|
|
|
{
|
|
|
|
sal_uInt8 nScriptCount = 0;
|
|
|
|
|
2015-04-15 09:36:39 +02:00
|
|
|
if (nScriptType & SvtScriptType::LATIN)
|
2014-02-10 01:26:35 -05:00
|
|
|
++nScriptCount;
|
2015-04-15 09:36:39 +02:00
|
|
|
if (nScriptType & SvtScriptType::ASIAN)
|
2014-02-10 01:26:35 -05:00
|
|
|
++nScriptCount;
|
2015-04-15 09:36:39 +02:00
|
|
|
if (nScriptType & SvtScriptType::COMPLEX)
|
2014-02-10 01:26:35 -05:00
|
|
|
++nScriptCount;
|
|
|
|
|
2014-02-10 01:31:35 -05:00
|
|
|
return nScriptCount == 1;
|
2014-02-10 01:26:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-11-25 16:50:10 +00:00
|
|
|
// returns: true if a word for thesaurus look-up was found at the current cursor position.
|
|
|
|
// The status string will be word + iso language string (e.g. "light#en-US")
|
2015-01-05 13:05:50 +01:00
|
|
|
bool GetStatusValueForThesaurusFromContext(
|
2013-08-11 21:36:15 +04:00
|
|
|
OUString &rStatusVal,
|
2009-11-25 16:50:10 +00:00
|
|
|
LanguageType &rLang,
|
|
|
|
const EditView &rEditView )
|
|
|
|
{
|
|
|
|
// get text and locale for thesaurus look up
|
2013-05-16 13:08:34 -03:00
|
|
|
OUString aText;
|
2009-11-25 16:50:10 +00:00
|
|
|
EditEngine *pEditEngine = rEditView.GetEditEngine();
|
|
|
|
ESelection aTextSel( rEditView.GetSelection() );
|
|
|
|
if (!aTextSel.HasRange())
|
|
|
|
aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
|
|
|
|
aText = pEditEngine->GetText( aTextSel );
|
|
|
|
aTextSel.Adjust();
|
2014-02-10 01:26:35 -05:00
|
|
|
|
|
|
|
if (!isSingleScriptType(pEditEngine->GetScriptType(aTextSel)))
|
|
|
|
return false;
|
|
|
|
|
2009-11-25 16:50:10 +00:00
|
|
|
LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos );
|
2013-07-13 02:54:05 +02:00
|
|
|
OUString aLangText( LanguageTag::convertToBcp47( nLang ) );
|
2009-11-25 16:50:10 +00:00
|
|
|
|
|
|
|
// set word and locale to look up as status value
|
2013-08-11 21:36:15 +04:00
|
|
|
rStatusVal = aText + "#" + aLangText;
|
2009-11-25 16:50:10 +00:00
|
|
|
rLang = nLang;
|
|
|
|
|
2013-05-16 13:08:34 -03:00
|
|
|
return aText.getLength() > 0;
|
2009-11-25 16:50:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-05 13:05:50 +01:00
|
|
|
void ReplaceTextWithSynonym( EditView &rEditView, const OUString &rSynonmText )
|
2009-11-25 16:50:10 +00:00
|
|
|
{
|
|
|
|
// get selection to use
|
|
|
|
ESelection aCurSel( rEditView.GetSelection() );
|
|
|
|
if (!rEditView.HasSelection())
|
|
|
|
{
|
|
|
|
// select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord.
|
|
|
|
// (In the end both functions will call ImpEditEngine::SelectWord)
|
|
|
|
rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD );
|
|
|
|
aCurSel = rEditView.GetSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
// replace word ...
|
|
|
|
rEditView.InsertText( rSynonmText );
|
2014-02-20 11:55:27 +02:00
|
|
|
rEditView.ShowCursor( true, false );
|
2009-11-25 16:50:10 +00:00
|
|
|
}
|
|
|
|
|
2010-02-12 11:22:34 +01:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|